System.Windows.Forms sizing grip problem

A

Andrei Zinca

When I resize my window, the sizing grip from the status bar doesn't
dissapear. The funny thing is that if i create a graphics object and dispose
it before the creation of the status bar everything works fine.

Maybe someone can help me with this problem. Thanks!

Here's my StatusBar initialization routine

void InitStatusBar()
{
Graphics g = CreateGraphics(); // If i do this
g.Dispose(); // it works

sb = new StatusBar();
sb.Parent = this;
sb.ShowPanels = true;

// Help panel
sb.Panels.Add("Help");
sb.Panels[0].AutoSize = StatusBarPanelAutoSize.Spring;
sb.Panels[0].Alignment = HorizontalAlignment.Left;

// Date panel
sb.Panels.Add(DateTime.Now.ToShortDateString());
sb.Panels[1].AutoSize = StatusBarPanelAutoSize.Contents;
sb.Panels[1].Alignment = HorizontalAlignment.Center;

// Time panel
sb.Panels.Add(DateTime.Now.ToShortTimeString());
sb.Panels[2].AutoSize = StatusBarPanelAutoSize.Contents;
sb.Panels[2].Alignment = HorizontalAlignment.Center;
}
 
Top