Image Flicker
-
I am drwaing images on a view So I develped a owner draw control to darw images. I also need to draw blue order around on mouse hover So I am also drwing. But I am facing some flickering issue How can I reduce it?
By making your paint code as swift as possible: don't create objects, don't paint more than necessary, etc. Show your code if you need detailed help. Alternatively, for rubber-banding kind of stuff, have a look at ControlPaint.DrawReversibleFrame(). Warning: it also paints outside the intended Control! :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Season's Greetings to all CPians.
-
I am drwaing images on a view So I develped a owner draw control to darw images. I also need to draw blue order around on mouse hover So I am also drwing. But I am facing some flickering issue How can I reduce it?
-
I am drwaing images on a view So I develped a owner draw control to darw images. I also need to draw blue order around on mouse hover So I am also drwing. But I am facing some flickering issue How can I reduce it?
You might also try handling WM_ERASEBKGND. Do nothing in the handler and return a non-zero value. This will prevent the view window being flood-filled with the window class brush color just before each call to WM_PAINT. The other key is using some double-buffering scheme. Draw your content on an off-screen bitmap and then blit that to your view, rather than drawing in the view itself.
L u n a t i c F r i n g e
-
I am drwaing images on a view So I develped a owner draw control to darw images. I also need to draw blue order around on mouse hover So I am also drwing. But I am facing some flickering issue How can I reduce it?
When is the flickering occuring?
Steve
-
I am drwaing images on a view So I develped a owner draw control to darw images. I also need to draw blue order around on mouse hover So I am also drwing. But I am facing some flickering issue How can I reduce it?
Flicker occurs when there are intermediate pixels on the screen. Example: draw a blue,filled rectangle, then draw a non-rectangle bitmap over that. The blue pixels 'under' the bitmap cause the effect. There are 2 solutions: 1) avoid the drawing of unneeded pixels by making your algorithm better (and faster) or using regions (see winapi documentation), 2) draw everything in a buffer (memory DC) and transfer that to the screen. This is called 'double buffering'. The first solution is most of the times too difficult to implement, so solution 2 is widely used, although it is actually slower.