WinForms controls are flickering when resizing on Windows7 x64
This very strange.
When I resize a WinForms dialog the controls are flickering very bad, some of them are disappearing. It happens only when using th开发者_如何学JAVAe application under Windows 7 64.
The solution for my problem is listed here:
http://blogs.msdn.com/b/alejacma/archive/2008/11/20/controls-won-t-get-resized-once-the-nesting-hierarchy-of-windows-exceeds-a-certain-depth-x64.aspx
Double buffering is disabled in Windows Forms
by default, and unfortunately you get this flickering issue as a result. It's a pain, but that's the way that it is. You may want to read the following, or provide some more information about your situation if these do not solve the problem.
- Why is DoubleBuffered disabled by default?
- How to prevent a Windows Forms TextBox from flickering on resize?
- How to prevent flickering in ListView when updating a single ListViewItem’s text?
- How to double buffer .NET controls on a form?
- Double-buffered Tree and List views
I had a similar problem with onResize event and I finally could fix it adding Invalidate():
protected override void OnResize(EventArgs e) {
Invalidate();
base.OnResize(e);
}
I know that redraw the screen each time the event happens is not the wished way to do it, but it worked for me.
精彩评论