Flickering at OnPaint( )


Z

Zombiekas

Hi frnd,

I'm using a onPaint() event of a custom control to draw a
couple of labels and textboxes. The problem is that the
onPaint() causes a lot of flickering.
Can u suggest me a way to minimize the fickering..?
Any suggestion or tip would be of great help.

Thanks
 
Ad

Advertisements

J

Justin Weinberg

Do the CF Version of double buffering. Draw to an offscreen bitmap and then
in onPaint, draw the bitmap to the surface.

The only think that concerns me in offering this solution is that you say
you are drawing "a couple of labels and textboxes" in OnPaint. If they need
control type interactivity, this probably won't work. If you're drawing
custom rectangles and using Drawstring, then it's applicable.
 
T

Thomas

It might also be possible that you have forgotten to override the
onPaintBackground() method of your control class.

Thomas
 
Ad

Advertisements

G

Geoff Schwab [MSFT]

Hi Zombiekas,

Check out this FAQ entry on optimizing drawing, it also applies to this
problem. The two primary methods for reducing flickering that I have found
are:
1. Only re-draw portions of the screen that have changed
2. Use an off-screen bitmap to "double-buffer" your draws

2.2. What can I do to optimize GDI+ rendering?
http://msdn.microsoft.com/mobility/prodtechinfo/devtools/netcf/FAQ/default.aspx#2.2

--
Geoff Schwab
Program Manager
Excell Data Corporation
http://msdn.com/mobility
http://msdn.microsoft.com/mobility/prodtechinfo/devtools/netcf/FAQ/default.aspx

This posting is provided "AS IS" with no warranties, and confers no rights.
 

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