Repaint Rectangle on Rectangle without flashing, Windows 7, Delphi -
i wish draw graph, , paint rectangle in centre of it. using delphi 7, has been done this:
with graphform.canvas begin brush.color:=clwhite; brush.style:=bssolid; pen.color:=clwhite; rectangle(1,y0,639,y0-341); end; //short wait while other things happen graphform.waitlab.invalidate;
that causes terrible flashing: white rectangle washes waitlab away, after short wait, waitlab repainted. waitlab smaller rectangle in center of larger field.
if turn off window painting, window doesn't painted @ all. if turn off window painting, turn on again , repaint window, i've got original problem: i'm painting rectangle white, colored.
the canvas code runs (and must run) in paint event handler, since white field not delphi control, needs explicitly repainted on every paint message form. waitlab delphi control delphi repaints after invalidate. invalidate code line not in paint event handler: cause tight loop.
but code run asynchronously on comm event changes of other things painted on form, , direct call painting code.
i don't know if there technical solution, or if there solution program logic. suggest?
use invalidaterect
instead of invalidate
.
using invalidaterect
, can tell windows repaint specific rectangle in canvas. in case, rect(1,y0,639,y0-341)
.
Comments
Post a Comment