DCSIMG
Windows Forms - עומר.נט

Browse by Tags

All Tags » Windows Forms (RSS)

Why Reship a Buggy API?

Posted Jul 11 2007, 10:24 AM by עומר ון קלוטן  

Version 1.0 of the .NET Framework introduced System.Drawing.Region 's Union method , designed to union two regions or several other types into a region. A bug, first reported in 2001, caused unexpected behavior. The method's output was determined as unreliable. Version 1.1 went past and the bug was not...

Windows Forms' GenerateMember

Posted Apr 12 2007, 05:05 PM by עומר ון קלוטן  

A little known, as far as I can tell from asking around, yet extremely useful property in the Windows Forms designer's property grid is GenerateMember . Defaulting to true , it decides whether a control/component gets declared as a field on the form ( true ) or as a local variable in the InitializeComponent...

Finding Out Why Control.Invoke Throws Undocumented Exceptions

Posted Apr 01 2007, 02:38 AM by עומר ון קלוטן  

A colleague was baffled by having Control.Invoke (when called from a different thread) throw an ArgumentException at him and asked if I knew what was happening. Opening the stack trace, I found that the exception originated from Control.MarshaledInvoke : at System.Windows.Forms.Control.MarshaledInvoke...

Bubbling Windows Forms Events With Anonymous Methods

Posted Mar 08 2007, 05:24 PM by עומר ון קלוטן  

The following code illustrates a great use for anonymous methods. public class MyContainerControl : Control { private class MySpecializedControl : Control { protected virtual void OnMyEvent(EventArgs e) { if ( this .MyEvent != null ) this .MyEvent( this , e); } public event EventHandler MyEvent; } private...

Generic Windows Forms Controls

Posted Mar 08 2007, 05:13 PM by עומר ון קלוטן  

Today I discovered that the Windows Forms Designer in Visual Studio 2005 doesn't know how to handle generics. For instance, the following example: private class MyControl<T> : System.Windows.Forms.Control { } could not be dropped in a Windows Forms designer (more on that in a little bit). If you...