Search code examples
c#winformsstatusbardoublebuffered

How do I enable double-buffering on the Windows Forms StatusBar?


Is there a way to enable double buffering on the Windows Forms StatusBar class?

I'm updating some map coordinates on a mouse-move event, and the flashing / repaint is severely obvious. I've tried inheriting from the StatusBar class and setting its DoubleBuffer = true and overriding its OnPaintBackground method. I also tried the owner-draw stuff with without any luck.


Solution

  • The System.Windows.Forms.StatusBar is a legacy control, it might not care about the DoubleBuffered property. You can try setting it like so in the constructor of a derived class:

    this.SetStyle(ControlStyles.DoubleBuffer, true);

    Although I would really recommend trying the StatusStrip control. It's made for Windows Forms and not drawn by the OS while the StatusBar is.