Jelle Druyts .NET Consultant
Just another ignorant weirdo from Antwerp, Belgium trying to make sense out of it all
There's a bug in the .NET implementation (both 1.0 and 1.1) of the System.Windows.Forms.StatusBar control which allows it to be resized independently of the form (and don't tell me this is "by design" ).
System.Windows.Forms.StatusBar
If you have a Form with a StatusBar on it that contains a Panel autosized to its Contents, just maximize the form and you'll see what goes wrong. The resize handle (called a SizingGrip) on the StatusBar that is normally used to resize the window is still there and can be used to resize the StatusBar (in stead of the window - since it's maximized now).
Fortunately, there's a pretty easy workaround for this: just hide the SizingGrip when the form is maximized as shown in the following example:
protected override void OnResize( EventArgs args ) { // Check if status bar already exists. if( m_StatusBar != null ) { // Sizing grips must be manually removed when maximizing! m_StatusBar.SizingGrip = ( WindowState == FormWindowState.Normal ); } // Resize with adjusted status bar. base.OnResize( args ); }
I just noticed that this bug doesn't occur on Windows XP (it certainly does on Win2K), it seems to be hiding the sizing grip when the window is maximized. Hmm how can that be when the .NET runtime is supposed to be platform independant?