Double buffering a groupbox

G

Guest

My dialog has groupboxes with slow to redraw controls, to improve the
appearance I want to doublebuffer it. While I can use SetStyle() in the
Dailogs constructor the setting change doesn't get propagated to the
groupbox, and since it's a protected method I can't call groupbox.SetStyle().
I've tried deriving a custom class from System.Windows.Forms.GroupBox and
calling SetStyle from inside of it's constructor and from a new method. Both
were unsuccessful.

I can approximate a groupboxes appearance and get double buffering by
replacing it with a panel and placing a label on it's border but none of the
allowed borders for a panel are the same as the one used by a gb.

Is there any way to either force the GB to doublebuffer itself and contained
controls, or change the appearance of the panels border to more closely match
that of a GB?
 
B

Bob Powell [MVP]

Double buffering applies only to the surface of the control itself. Not the
child controls within it.

These child controls all have their own windows and handle their drawing
individually so setting the double buffering in a parent will have no
effect.

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

Ramuseco Limited .NET consulting
http://www.ramuseco.com

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

Bob Powell said:
Double buffering applies only to the surface of the control itself. Not the
child controls within it.

These child controls all have their own windows and handle their drawing
individually so setting the double buffering in a parent will have no
effect.

Hmmm. How can I stop the flicker whenever I resize my form. Putting my
controls in a groupbox makes the problem worse than leaving them on the main
form or sticking them in a panel instead. I've also managed to improve
performance a bit by setting Bounds instead of making seperate Size and
Location changes. Is there a way to stop redraws until my Resize event
completes it's work.
 

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