Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualunbird

Posted 21 December 2012 - 08:29 AM

To prevent OnPaintBackground (or anything else that causes that flicker) you need to dig deeper into the Windows API or the .NET Framework - or both.

Inheriting a control (preferably UserControl) and overriding OnPaintBackground with not calling base.OnPaintBackground() is one possibility.

There's also the control style flag ControlStyles.Opaque: Enable it through Control.SetStyle. Look into the other styles (AllPaintingInWmPaint, UserPaint). Again, this method is protected, so you need to inherit here.

Sometime going bare Win API by e.g. overriding WndProc or use p/invoke is even needed (not in this case though).

PS: Additional advice: To do it cleanly, you should use a custom swapchain - for every control.

#1unbird

Posted 21 December 2012 - 07:40 AM

To prevent OnPaintBackground (or anything else that causes that flicker) you need to dig deeper into the Windows API or the .NET Framework - or both.

Inheriting a control (preferably UserControl) and overriding OnPaintBackground with not calling base.OnPaintBackground() is one possibility.

There's also the control style flag ControlStyles.Opaque: Enable it through Control.SetStyle. Look into the other states (AllPaintingInWmPaint, UserPaint). Again, this method is protected, so you need to inherit here.

Sometime going bare Win API by e.g. overriding WndProc or use p/invoke is even needed (not in this case though).

PS: Additional advice: To do it cleanly, you should use a custom swapchain - for every control.

PARTNERS