Is there some trick to double buffer a whole form without having to subclass
every single control on it to make each control double buffered?
I've noticed that when I resize my form the controls on it starts flicking
so much it's not even funny.

I thought I could be clever and do something like this

foreach(Control c in this.Controls){
// Set the value of the double-buffering style bits to true.
c.SetStyle(ControlStyles.DoubleBuffer, true);
}

but that won't work since the SetStyle method is declared as protected in
Control. (Why is it declared protected?)

Martin

Re: Double buffer a form by Bob

Bob
Sun Apr 24 15:51:10 CDT 2005

Because all controls on a form are autonomous windows double bufferng the
form has no effect on the flickering of the controls.

The short answer is no. You may however like to look at options such as
suspending layout for a short time while resizing is going on.

--
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.





"Martin Stenhoff" <no@thereisno.ne> wrote in message
news:426b66a2@dnews.tpgi.com.au...
> Is there some trick to double buffer a whole form without having to
> subclass every single control on it to make each control double buffered?
> I've noticed that when I resize my form the controls on it starts flicking
> so much it's not even funny.
>
> I thought I could be clever and do something like this
>
> foreach(Control c in this.Controls){
> // Set the value of the double-buffering style bits to true.
> c.SetStyle(ControlStyles.DoubleBuffer, true);
> }
>
> but that won't work since the SetStyle method is declared as protected in
> Control. (Why is it declared protected?)
>
> Martin
>
>



Re: Double buffer a form by Martin

Martin
Sun Apr 24 22:18:21 CDT 2005

Yeah I noticed that making a form double buffered has not impact on the
child controls.

But is there a good reason for not being able to call Control.SetStyle()
from outside the
Control class?

Martin

"Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
news:O6hVB9QSFHA.2784@TK2MSFTNGP12.phx.gbl...
> Because all controls on a form are autonomous windows double bufferng the
> form has no effect on the flickering of the controls.
>
> The short answer is no. You may however like to look at options such as
> suspending layout for a short time while resizing is going on.
>
> --
> 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.
>
>
>
>
>
> "Martin Stenhoff" <no@thereisno.ne> wrote in message
> news:426b66a2@dnews.tpgi.com.au...
>> Is there some trick to double buffer a whole form without having to
>> subclass every single control on it to make each control double buffered?
>> I've noticed that when I resize my form the controls on it starts
>> flicking so much it's not even funny.
>>
>> I thought I could be clever and do something like this
>>
>> foreach(Control c in this.Controls){
>> // Set the value of the double-buffering style bits to true.
>> c.SetStyle(ControlStyles.DoubleBuffer, true);
>> }
>>
>> but that won't work since the SetStyle method is declared as protected in
>> Control. (Why is it declared protected?)
>>
>> Martin
>>
>>
>
>



Re: Double buffer a form by Bob

Bob
Mon Apr 25 04:09:45 CDT 2005

I suppose that from a class design point of view the style was made
protected so that external classes couldn't fundamentally change the drawing
system without the control providing a specific mechanism for doing so.

Those styles can have far-reaching consequences for drawing and mouse input.

--
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.





"Martin Stenhoff" <no@thereisno.ne> wrote in message
news:426c6180$1@dnews.tpgi.com.au...
> Yeah I noticed that making a form double buffered has not impact on the
> child controls.
>
> But is there a good reason for not being able to call Control.SetStyle()
> from outside the
> Control class?
>
> Martin
>
> "Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
> news:O6hVB9QSFHA.2784@TK2MSFTNGP12.phx.gbl...
>> Because all controls on a form are autonomous windows double bufferng the
>> form has no effect on the flickering of the controls.
>>
>> The short answer is no. You may however like to look at options such as
>> suspending layout for a short time while resizing is going on.
>>
>> --
>> 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.
>>
>>
>>
>>
>>
>> "Martin Stenhoff" <no@thereisno.ne> wrote in message
>> news:426b66a2@dnews.tpgi.com.au...
>>> Is there some trick to double buffer a whole form without having to
>>> subclass every single control on it to make each control double
>>> buffered?
>>> I've noticed that when I resize my form the controls on it starts
>>> flicking so much it's not even funny.
>>>
>>> I thought I could be clever and do something like this
>>>
>>> foreach(Control c in this.Controls){
>>> // Set the value of the double-buffering style bits to true.
>>> c.SetStyle(ControlStyles.DoubleBuffer, true);
>>> }
>>>
>>> but that won't work since the SetStyle method is declared as protected
>>> in Control. (Why is it declared protected?)
>>>
>>> Martin
>>>
>>>
>>
>>
>
>