|
When is size assignment is done for the first time is done to a control?
|
|
|
|
|
at the form constructor in InitComponents() ,the windows designer handwork
I hope you understand...
By the way... visit http://nehe.gamedev.net[^]
|
|
|
|
|
Look in the "Windows Form Designer Generated Code" Region. You'll find all the properties, that are not default values, of your controls are set in there.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
From Life Cycle point of view when the page's Initialise id called it in turn calls the init of all controls on that page. At this point the control is initialised with all its properties. And finally after all the controls the Page initialise gets over.
Is this what u wanted.
Ketty
|
|
|
|
|
How can I print the content from a RichTextBox control?
the richTextBox.Document thing does not exist so how can I do it!
|
|
|
|
|
I think i already post answer for the same question.
Anyhow don't upset.;)
<br />
try<br />
{<br />
PrintDia=new PrintDialog();<br />
PrintDia.Document=printDocument1;<br />
string content=this.RitchEditor.Text;<br />
StrReader=new StringReader(content);<br />
if(PrintDia.ShowDialog()==DialogResult.OK)<br />
{<br />
this.printDocument1.Print();<br />
}<br />
}<br />
catch(Exception Ex)<br />
{<br />
MessageBox.Show(Ex.Message.ToString());<br />
}<br />
This much is very easy one who know how to print the content. Next is importent.
<br />
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)<br />
{<br />
try<br />
{<br />
float Lines_Per_Page = 0;<br />
float Y_Position = 0; <br />
int Count = 0;<br />
float Left_Margin = e.MarginBounds.Left;<br />
float Top_Margin = e.MarginBounds.Top;<br />
<br />
string Line = null;<br />
Font fnt = Editor.Font;<br />
SolidBrush Solid = new SolidBrush(Color.Black);<br />
<br />
Lines_Per_Page=e.MarginBounds.Height/Font.GetHeight(e.Graphics);<br />
<br />
while(Count < Lines_Per_Page && ((Line=StrReader.ReadLine())!=null ))<br />
<br />
{<br />
<br />
Y_Position =Top_Margin + (Count * fnt.GetHeight(e.Graphics));<br />
<br />
<br />
e.Graphics.DrawString(Line ,fnt ,Solid ,Left_Margin ,Y_Position ,new StringFormat());<br />
<br />
Count++;<br />
}<br />
<br />
if(Line !=null)<br />
e.HasMorePages=true;<br />
else<br />
e.HasMorePages=false;<br />
}<br />
catch(Exception Ex)<br />
{<br />
MessageBox.Show(Ex.Message.ToString());<br />
}<br />
<br />
<br />
}
Sreejith Nair
[ My Articles ]
|
|
|
|
|
|
Dear Mr. Gold !
I'm trying to find out about Face Recognition system using neural network (back propagation algorithm). I intent to write a program using C#.The most importance in face recognition is preprocessing step, i know that we can feed network with a pixel matrix of image but i don't know how to do this?? And would you mind give me some algorithm for image processing to improve its quanlity as reduce intensity, light, noise????
|
|
|
|
|
Hi
I am writing a windows forms app in C# and sometimes when i build and run the application in debug mode I get the two error screens with the following messages
An unhandled exception of type 'System.NullReferenceException' occured in Unknown Module
There is no source code available for the current location.
Does anyone have any ideas about this? There is no call stack to see where the issue is.
It does not occur every single time. Only about fifty percent of the time but it is anoying.
Thanks for any help.
|
|
|
|
|
try starting the program in debug mode directly. take every code line that is in main and surely you will find the code that makes you headaches. i don't think that the exception is from the .net implementation, maybe you letted an variable unalocated (when one defines a variable assignes it a value, a default value, just to be sure )
I hope you understand...
By the way... visit http://nehe.gamedev.net[^]
|
|
|
|
|
Excuse me, but what are you talking about?????????????????????????????????????
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
//VC++:
memset( SPTWB, 0, Marshal.SizeOf( Win32.SCSI_PASS_THROUGH_WITH_BUFFERS ) );
If C# has an identical funtion to do the same work?
|
|
|
|
|
|
can anybody help me to suspend a process and then resume it also
|
|
|
|
|
What do you mean by "suspend process"?
If your talking about what I'm thinking, you can't. A process can be tagged low priorty, but must remain running to keep it's message pump alive and processing messages. This would include having the app repaint it's client window when necessary, even though the user is not interacting with the app. If you suspend the process and move a smaller window over the suspended process, it won't repaint itself. This would have the effect of having one window "erase" the window of the suspended process.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Is Thread.Sleep(milliseconds) what you need?
Regards,
Alvaro
Our enemies are innovative and resourceful, and so are we. They never stop thinking about new ways to harm our country and our people, and neither do we. - George W. Bush
|
|
|
|
|
Hi All,
Is it possible to get the address of an object reference
variable in C#?
Cheers
|
|
|
|
|
In my form application, I repeatedly obtain graphics from a sequence of images by using Graphics.FromImage(...). At first few calls, it is fine. But after a while, there will an exception: System.InvalidOperationException: The object is currently in use elsewhere.
I checked on the web, it seems this is related to a microsoft bug and can be solved by a hotfix. I updated my machine with several patches, but the problem is still there.
Any suggestion? Thanx.
|
|
|
|
|
Have you ever called Disposed on Graphics object?
Maqsood Ahmed
Kolachi Advanced Technologies
http://www.kolachi.net
|
|
|
|
|
Yes, I did. I tried both with dispose and no dispose. There is no difference.
|
|
|
|
|
how would i make a control that can save and edit bmps and have a grid like the following...
___________
| | | | | |
-----------
| | | | | |
-----------
| | | | | |
-----------
| | | | | |
-----------
| | | | | |
-----------
| | | | | |
-----------
|
|
|
|
|
Hi~
In C# compact framework, I would like to send a message to a window written using "SendMessage" method by p/Invoke.
How can I pass the string to p/invoke method so that the C++ window can get the message? If a pass string, How to convert the lparam into string in C++
windows message loop function? If pass the string as other type, then what is the type?
In compact framework, the key word "MarshalAs" is not supported. Then is there any other way to solve it?
[DllImport("coredll.dll",EntryPoint="SendMessage", CharSet=CharSet.Auto)]
private static extern void SendMessage(IntPtr hwnd, uint msg, int wparam, [MarshalAs(UnmanagedType.LPSTR)] string lparam);
Thanks
|
|
|
|
|
MarshalAs isn't a keyword - it's an attribute, as in MarshalAsAttribute . What you have isn't even correct on the full .NET Framework, though. Why do you set CharSet=CharSet.Auto , then try to marshal the string as an UnmanagedType.LPSTR ? An LPSTR is a char* . You should marshal as an LPTSTR (TCHAR* ), but setting the CharSet field to CharSet.Auto does that automatically.
The only reason overloading the SendMessage function like this would work is because by passing a TCHAR* you pass the address of the first character (rather, the first byte which is 1 character in ANSI and 2 Unicode (typically). Since both an WPARAM and LPARAM are just addresses (32 bits on a 32-bit system, and 64 bits on a 64-bit system, unless you're running under WOW64 to emulate a 32-bit processor for a 32-bit application, which is currently all that's available with .NET 1.x), the following signature should work for you:
[DllImport("user32.dll", CharSet=CharSet.Auto)]
extern static IntPtr SendMessage(IntPtr hWnd, uint msg, IntPtr wParam, string lParam); As you may have noticed, I've changed the signature a little more. The return value should be an IntPtr . By not defining the return value correctly you could corrupt the stack (a return value needs to be pushed back onto the stack whether or not you use it). And, as I said, both the WPARAM and LPARAM parameters are processor-dependent so you need to use an IntPtr (which is also a processor-dependent bit width). If you recompiled for 64-bit processors ever, your code would not work (you'd be trying to call the 32-bit SendMessage on the 64-bit implementation and should surely have an execution stack problem since your parameters wouldn't be correct and you'd end up passing something else (uninitialized data, etc. - definitely not your address and most likely ending up with an Access Violation (AV) exception).
PS: To pass 0 as the wParam that's now correctly defined as an IntPtr , use IntPtr.Zero .
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Then, I pass a string to the method "SendMessage". How can I turn the lparam to LPSTR or any other string pointer? It is simple that just cast the lparam to string pointer? Thanks
|
|
|
|
|
You really need to understand the difference between LPSTR , LPWSTR , and LPTSTR . Since CharSet.Auto is specified in the DllImportAttribute , the string (always Unicode in .NET) will be marshaled as ANSI strings on Win9x/Me and Unicode strings on Windows NT (includes 2K, XP, 2K3, and future versions of Windows).
If you need to marshal from an IntPtr to a string (assuming that memory address points to a string) then use the relevent Marshal class methods, like Marshal.PtrToStringAuto . Read more about the class in the .NET Framework SDK for more information.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|