Flickering at OnPaint( )

  • Thread starter Thread starter Zombiekas
  • Start date Start date
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
 
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.
 
It might also be possible that you have forgotten to override the
onPaintBackground() method of your control class.

Thomas
 
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.
 
Back
Top