Can anyone suggest the best way to constrain a form to horizontal resizing only?
Delegating a Resize handler doesn't work so great. If I set Height=400; in the Resize handler, it does indeed force the window to a height of 400 (or whatever you like) but when the user drags the window border, the window momentarily resizes to fit the mouse, and then the handler kicks in and pushes it back to 400 and back and forth causes a nasty flicker.
I've seen some Win32 examples that process WM_NCHITTEST messages and return 0; but I don't see a way to do this with C# .NET Framework. Any ideas?
I have a question about these System Objects. What if the user changes his/her properties in Display Settings while the app is running? Do these colors change?
Quote from MSDN:
ActiveBorder: Gets a SolidBrush object that is the color of the active window's border.
ActiveCaption: Gets a SolidBrush object that is the color of the background of the active window's title bar.
ActiveCaptionText: Gets a SolidBrush object that is the color of the text in the active window's title bar. "
To me this would imply that the colors are changing. But then again I have been known to be wrong at times.
Hmmm... what's a signature?
Im looking for some advice. I have written a little thread that will check to see wether a text file has been updated. It compares the time for example. I as wondering, whats the best way to have a thread execute a method every few seconds without completely bogging down my main thread?
zhyluo2003 wrote: where is a's memory allocated? in the stack or heap?
Memory is allocated for all objects (primitives too). GC cleans it up. Note: That unlike C, everything goes onto the managed heap, so one can "dynamically" create a valuetype array. MS recommends using classes above structs for performance reasons.
Boxing is very expensive. Everytime you add a valuetype to an ArrayList for example it gets boxed (and making a typed collection doesnt get rid of it AFAIK). With a class you dont get that. Unfortunately the only place I could find something now, is in the EMCA 335 spec Partition 5
D.3. Type Usage Guidelines
D.3.1. Class Usage Guidelines
• Do favor using classes over any other type (i.e. interfaces or value types)
On the MSDN/C# homepage there is only a very informative article on performance.