StatusBar Resize Bug#

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" ;-) ).

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?

Blog | Programming | .NET | Quirks
Tuesday, February 22, 2005 7:11:50 PM (Romance Standard Time, UTC+01:00)
Just noticed this bug, too (having just changed a status bar to add some extra panels and made one of them autosize to contents) and I'm running XP SP2. So I'm afraid it does affect XP too :-(
Tuesday, February 22, 2005 7:16:18 PM (Romance Standard Time, UTC+01:00)
Just to add that this bug appears at the Microsoft support site:
http://support.microsoft.com/default.aspx?scid=kb;en-us;822486
Comments are closed.
All content © 2012, Jelle Druyts
On this page

Recent Photos
www.flickr.com
This is a Flickr badge showing public photos from Jelle Druyts. Make your own badge here.
Advertising
Top Picks
Statistics
Total Posts: 350
This Year: 0
This Month: 0
This Week: 0
Comments: 530
Archives
Sitemap
Disclaimer
This is my personal website, not my boss', not my mother's, and certainly not the pope's. My personal opinions may be irrelevant, inaccurate, boring or even plain wrong, I'm sorry if that makes you feel uncomfortable. But then again, you don't have to read them, I just hope you'll find something interesting here now and then. I'll certainly do my best. But if you don't like it, go read the pope's blog. I'm sure it's fascinating.

Powered by:
newtelligence dasBlog 2.0.7226.0

Sign In