Flickering

R

Robot

Hello,

I am creating an application using C# .NET.
In the main form is has got a few labels, panels,
buttons and treeView.
While changing size of window (by handling
right-bottom corner), everything is flickering in
horrible way. Each component is flickering in its
own way.

Of course, I set up doublebuffering:
SetStyle(ControlStyles.UserPaint |
ControlStyles.AllPaintingInWmPaint |
ControlStyles.DoubleBuffer, true);
UpdateStyles();

Unfortunatelly, it has not fixed the situation.

How to successfully set up doublebuffering?
I have read much about this, but did not find
any working solution.
Why doublebuffering set up by SetStyle
does not work?

Thanks in advance.

Robot
 
B

Bob Powell [MVP]

Double buffering only works for the individual window attached to each
control. You cannot double buffer the whole form.

You may be able to reduce the problem by managing the layout events.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
G

Guest

I assume you are repositioning and resizing the controls on your form as it
is resized. Wait for Whidbey, maybe. Supposedly it will handle your case.

I had a similar problem and tried the same things. In my case, I developed a
user control in which I wanted its constituent controls resized in the
Designer. The code works but there is some flicker. The other thing I tried
that you didn't mention was to handle the Layout event. In the event handler:

this.SuspendLayout

// Resize and reposition controls

this.ResumeLayout
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top