Bob,
From your reply then, if I manually perform the double buffering, does =
that imply that it would then be a bit stupid to apply the control =
styles as well?
rollasoc
[quoted text, click to view] "Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message =
news:#vOyJH5UDHA.1952@TK2MSFTNGP11.phx.gbl...
>>So when I want to implement double buffering in my application I =
just have to set the above three styles? Or do I have to paint =
everything manually on a bitmap and then push that back to the form?
Generally I would recommend using the built in ControlStyles for ease =
of use. It's completely transparent to your code and a no-brainer. The =
article in question discusses the process of double buffering to =
illustrate the why's and wherefores of the technique and so is =
interesting from that point of view.
There are also reasons why you may wish to perform your own double =
buffering which I discuss in an article on the subject which can be =
found in the tips and tricks section of my site.
http://www.bobpowell.net/tipstricks.htm --=20
Bob Powell [MVP]
C#, System.Drawing
Check out the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm Buy quality Windows Forms tools
http://www.bobpowell.net/xray_tools.htm New Tips and Tricks include creating transparent controls
and how to do double buffering.
[quoted text, click to view] "Gerben van Loon" <nospamplz_gerbenvl@home.nl> wrote in message =
news:bfu062$tlg$1@news1.tilbu1.nb.home.nl...
Hi,
=20
I just read this article about double buffering in GDI+ :
=20
http://windowsforms.net/articles/windowsformspainting.aspx =20
He shows how to double buffer with this kind of code:
=20
//create our offscreen bitmap
Bitmap localBitmap =3D new =
Bitmap(ClientRectangle.Width,ClientRectangle.Height);
Graphics bitmapGraphics =3D Graphics.FromImage(localBitmap);
=20
//Draw things on the bitmap
=20
//push our bitmap forward to the screen
g.DrawImage(localBitmap, 0, 0);
=20
What he's doing here manually isn't that exactly what is done FOR =
you automatically by settings these styles:
=20
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.DoubleBuffer, true);
=20
So when I want to implement double buffering in my application I =
just have to set the above three styles? Or do I have to paint =
everything manually on a bitmap and then push that back to the form?
=20