posted on Monday, January 16, 2006 2:10 AM by admin Rated Excellent [5 out of 5].

Winforms Flicker in VS.Net 2005

I am currently working on a winform project using VS.Net 2005.  I find it decidedly inconvenient to see the winforms flicker repeatedly for several seconds when the user clicks outside the win form dialog that is currently in focus.

It appears that it is a known problem but I can't wait to find a solution. Is anyone suffering from the same complaint as I am?

Obi Oberoi

 

Comments

# re: Winforms Flicker in VS.Net 2005

Wednesday, January 18, 2006 4:12 PM by samirbarot Remove Comment 6
http://www.codeproject.com/cs/miscctrl/ZsDotNetStatusBar.asp

http://www.dotnet247.com/247reference/msgs/50/253457.aspx

Public Sub EnableDoubleBuffering()
' Set the value of the double-buffering style bits to true.
Me.SetStyle(ControlStyles.DoubleBuffer _
Or ControlStyles.UserPaint _
Or ControlStyles.AllPaintingInWmPaint, _
True)
Me.UpdateStyles()
End Sub

In your user control's constructor you should use the following:
' Stop the flicker
Me.SetStyle(ControlStyles.UserPaint, True)
Me.SetStyle(ControlStyles.DoubleBuffer, True)
Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True)
Me.SetStyle(ControlStyles.ResizeRedraw, True)
Me.UpdateStyles()