Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Double Buffering support

4 views
Skip to first unread message

Dieter De Preester

unread,
Dec 2, 2002, 10:47:32 AM12/2/02
to
Hello

I can't find Double Buffering support in the compact
framework when i want to draw a control.
Is this supported or do i have to write it by myself ?
If yes, are there any examples available?

Regards
Dieter De Preester

Alex Yakhnin [MVP]

unread,
Dec 2, 2002, 1:35:41 PM12/2/02
to
Dieter,

You are right, that you will need to implement double-
buffering by yourself. It could look something like that:

protected override void OnPaint(PaintEventArgs pea)
{
Graphics grfx = pea.Graphics;

Graphics offScreenGraphics;
Bitmap offscreenBitmap;

offscreenBitmap = new Bitmap
(BackgroundBitmap.Width, BackgroundBitmap.Height);
offScreenGraphics = Graphics.FromImage
(offscreenBitmap);

if (BackgroundBitmap != null)
{
offScreenGraphics.DrawImage
(BackgroundBitmap, 0, 0, BackgroundBitmap.Width,
BackgroundBitmap.Height);
}

grfx.DrawImage(offscreenBitmap, 0, 0);
}

HTH... Alex

--
Alex Yakhnin, eMVP
IntelProg, Inc.
http://www.intelprog.com

>.
>

0 new messages