if you move mouse inside the window, severe flicker will
occurr (repaint sended by me)
is not possible to pretty-formatting the code?
this code is to show that the WM_PAINT after the WM_SIZE is a particular
type of WM_PAINT, handed differently from other WM_PAINTs
for this reason the Sleep serves to show the flickering and the invalidateRect
inside the paint routine serves to forcing to repaint the entire area as
you can
see checking the ps.rcPaint rectangle.
have you tried to compile and running this snippet?
Why would I do that ? I allready know that it will flicker.
the paint routine in WM_PAINT handler shows that if it happens
from a WM_SIZE , that is, a system-driven event at least in this
case, the result will not flicker;
if the WM_PAINT happens from the WM_MOUSEMOVE event,
that is, a user-driven event at least in this case, the result will
flicker
abundantly.
running this code leads to the title question:
if you resize the window you will not see any flicker (repaint sended by the system)
if you move mouse inside the window, severe flicker will occurr (repaint sended by me)
how to reproduce the system-driven WM_PAINT?
how to reproduce the system-driven WM_PAINT?
Because the code directly draw on the application window,
AND with added delays, you'll see the progress as flickers.
Use a technique called double buffering.
That's exactly why.
JJ,
how to reproduce the system-driven WM_PAINT?
Because the code directly draw on the application window,
AND with added delays, you'll see the progress as flickers.
Use a technique called double buffering.
The question is not how to minimize the flicker, but why "the system"s paint doesn't, and his paint does flicker (even though he and "the system" execute the same, his paint code). He simply doesn't yet know what effect "invalidaterect" (the whole screen) has. Currently he just uses it to force a paint event to happen, but forgets to recon with its "side effects".
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 379 |
Nodes: | 16 (2 / 14) |
Uptime: | 41:51:40 |
Calls: | 8,141 |
Calls today: | 4 |
Files: | 13,085 |
Messages: | 5,857,792 |