|
This was asked over here[^], roughly.
|
|
|
|
|
Hi Guy
This is easy just use insertAtRow() method to table, u can insert a blank row after bind to Combobox.
thanks
Cheers
RRave
MCTS,MCPD
|
|
|
|
|
I dont have much knowledge about System.Drawing namespace,
I want to print a particular text in Bold letters with in printed page.
Its an window application, having a form similar to standard mail interface. like having fields
From:
To:
Subject:
Now user can print this form contents.
What I want to do feilds like From, To, Subject, should print in bold letters.
|
|
|
|
|
The Font that you use has a FontStyle property. When you create the font, set FontStyle.Bold. If my memory serves correctly, the call would look like this:
Font myFont = new Font("Verdana", 12, FontStyle.Bold);
|
|
|
|
|
|
What part of Pete's code wasn't clear and easy to understand?
He who makes a beast out of himself gets rid of the pain of being a man
|
|
|
|
|
Hi Guy
i told not like that meaning man, i told when we are give a full code or example for that , easilly he can better than one line code.
Thanks
Cheers
RRave
MCTS,MCPD
|
|
|
|
|
So which bit of my example didn't tell him how to create a bold font. One line that's all it takes. Anything else is just padding and wasting his time. He asked for information on how to put a bold font in, and that's exactly what I told him. How he draws that to the screen is up to him - because there are so many different ways he can do this.
|
|
|
|
|
Hi Guy
You are exactlly correct.OK but i gave additiional information to he, because of if we suugest a help more than he asked details, that's must eb help better than one line code. But ur one code not given a cooerct result
see what is he is asking?
I dont have much knowledge about System.Drawing namespace,
I want to print a particular text in Bold letters with in printed page.
But u given this line only
Font myFont = new Font("Verdana", 12, FontStyle.Bold);
So please explian how can do ONLY ONE LINE CODE with his work
Hey i'm also designer and developer all kind of applciations.
if u want to more come to vrrave@gmail.com
thanks
Cheers
RRave
MCTS,MCPD
|
|
|
|
|
Ok if you're being picky then he also needs this line:
myLabel.Font = myFont;
But I'm sure he can work it out for himself.
He who makes a beast out of himself gets rid of the pain of being a man
|
|
|
|
|
Hi Guy
Cool,Now see this line "I dont have much knowledge about System.Drawing namespace,"
I think we can stop.
Thanks
Cheers
RRave
MCTS,MCPD
|
|
|
|
|
Ravenet wrote: So please explian how can do ONLY ONE LINE CODE with his work
Are you new on these forums? We do ask that people do some work for themselves - we don't give them canned answers. What I did do was answer how to get a bold font, which seems to be the main focus of this question.
Now, your answer is incomplete (to a very large extent) because it doesn't deal with issues such as laying out items, measuring strings and the like. If you are not careful, you can end up coding an entire application for somebody in attempting to answer one part. Now I don't have the time for that nor, I suspect, do you.
Interestingly enough, it's only you who seems to be getting bent out of shape about my answer - not the OP. Why do you think that is? Do you think perhaps that he has enough information to carry on with his task?
|
|
|
|
|
OK cool, off
Thanks
Cheers
RRave
MCTS,MCPD
|
|
|
|
|
Ravenet wrote: when we are give a full code or example for that , easilly he can better than one line code.
That is far from always the truth.
If a single line of code provides exactly the information that the poster needs, that is much more efficient that providing hundreds of lines of text to wade through to get the information.
Quite often a poster only needs one small piece of information to solve the problem. Either it's the small missing piece in a method, or he can easily find all the rest of the information he needs once he knows what to look for.
Also, providing some specific piece of information is often a good method to find out what the poster needs, even if it's not exactly that piece of information. It's much easier to determine the usefulness of a single line of code than to find out if there might be something useful somewhere in a long article.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
Hi guys,
I need to write some formatted string into a notepad file that is already opened by the user. I tried using TextWriter , but we need to close and open the notepad file to reflect the changes. Also Process.StartInfo doesnot help. Can anyone help me out?
Thanks in advance.
Jrk
|
|
|
|
|
Hello,
One solution would be to use the Process class of System.Diagnostic namespace.
There you find a member called MainWindowHandle, which is an IntPtr.
In combination with the "user32.dll" method "SetForegroundWindow", you can activate the open notepad instance.
After that is done you could use "SendKeys.Send" method to send your text.
Here is a little demo:
using System.Runtime.InteropServices;
Process[] procNP = Process.GetProcessesByName("notepad");
if(procNP.Length>0)
{
if(procNP[0].MainWindowHandle!=IntPtr.Zero)
{
SetForegroundWindow(procNP[0].MainWindowHandle);
System.Threading.Thread.Sleep(100);
SendKeys.Send("Hello World!");
}
foreach(Process actP in procNP)
{
actP.Dispose();
}
}
[DllImport("user32.dll")]
private static extern int SetForegroundWindow (IntPtr hWnd);
Hope it helps!
All the best,
Martin
|
|
|
|
|
Thank you Martin. It solves my other problem. But this is different. I dont want the notepad to bring to the foreground. I want to update the openned notepad file while it is in the background. Can you help me?
Thanks
|
|
|
|
|
Hello,
Member 514252 wrote: Thank you Martin
Member 514252 wrote: I dont want the notepad to bring to the foreground. I want to update the openned notepad file while it is in the background
OK, I understand your task and tried to find a solution, but have to admit that I didn't succeed.
What have I tried:
SendMessage in cmnbination with WM_SETTEXT.
[DllImport("user32.dll",EntryPoint="SendMessage", CharSet=CharSet.Auto)]
private static extern int SendMessage( int hwnd, int uMsg, int wParam, System.Text.StringBuilder lParam);
private const int WM_SETTEXT = 0x000c;
SendMessage((int)procNP[0].MainWindowHandle,WM_SETTEXT, myText.Length, new System.Text.StringBuilder(myText));
Had the effect, that the FileNameChanged (HeadlineText of the Notepad) changed, not the text itselfe.
Sorry for not really helping you.
P.S.:A dirty workaround could be to reset the Foregroundwindow to your actual application
SetForegroundWindow(procNP[0].MainWindowHandle);
System.Threading.Thread.Sleep(100);
SendKeys.SendWait("Hello World!");
SetForegroundWindow(System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle);
What you have to check is if the notepad IsIconic (minimized).
If yes, the SendKeys will not work.
private const int SW_SHOWNORMAL = 1;
private const int SW_SHOWMINIMIZED = 2;
private const int SW_SHOWMAXIMIZED = 3;
[System.Runtime.InteropServices.DllImport("user32.dll")]
[return: System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Bool)]
private static extern bool IsIconic(IntPtr hWnd);
[DllImport("user32")]
private static extern int ShowWindow(IntPtr hwnd, int nCmdShow);
IntPtr handleNotePad = procNP[0].MainWindowHandle;
if(handleNotePad!=IntPtr.Zero)
{
bool wasIconic = IsIconic(handleNotePad);
if(wasIconic)
ShowWindow(handleNotePad, SW_SHOWNORMAL);
SetForegroundWindow(handleNotePad);
System.Threading.Thread.Sleep(100);
SendKeys.SendWait("Hello World!");
SetForegroundWindow(System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle);
if(wasIconic)
ShowWindow(handleNotePad, SW_SHOWMINIMIZED);
}
All the best,
Martin
|
|
|
|
|
Thank you again for your effort Martin.
As you said, i tried SendMessage-ing WM_CHAR, it works for Notepad and Wordpad. But i couldnot write into Excel or Word file.
With SendKeys, I am able to send text to any window.
Is there anyway we can do to avoid showing the file?
JRK
|
|
|
|
|
Hi,
does anyone know how to make release builds in Express Edition? The toolbars have two BLANK combo boxes in the "Standard" toolbar where I would normally select the CPU target and the Debug/Release options.
I'm currently looking at a project I created in the full 2008 edition (Team Studio Edition actually) but it still seems to be missing on any newly created projects.
Is this a limitation of the Express Edition?
Regards,
Ray
|
|
|
|
|
Ctrl+Shift+B
If you run without debugging it uses the release build, if you run with debugging it uses the debug build. This caught me out several times, but now I'm back on the Pro edition so I don't care.
|
|
|
|
|
Ed.Poore wrote: This caught me out several times, but now I'm back on the Pro edition so I don't care.
You're what we call "One of the technology haves."
|
|
|
|
|
Pete O'Hanlon wrote: One of the technology haves
Is there some subtle meaning behind this that I'm missing?
|
|
|
|
|
When you had express edition you were in the have nots. Now you're not you're in the haves. Clear? As mud?
|
|
|
|
|