Teis Draiby
1/5/2005 7:03:00 PM
Thanks yet again, Bob!
regards, Teis
> Invalidate calls the InvalidateRect Win32 API under the hood so the
> rectangle is added to the list of invalid rects and left there until a
> WM_PAINT message comes along.
>
> WM_PAINT might arrive because of the normal message loop activity or
because
> Refresh was called. That forces a repaint.
>
> Essentially there is no performance hit if you invalidate several
rectangles
> between paint cycles.
>
> --
> Bob Powell [MVP]
> Visual C#, System.Drawing
> > What happens if I call the Invalidate(Rectangle) method several times
> > between two OnPaint() calls?
> > - is the resulting invalidated rectangle then added together from each
> > Invalidate(Rectangle)
> > - or are the calls queued to be executed later by one OnPaint() per
> > Invalidate(), causing an overhead if the rectangles overlap?
> >
> > Put differently:
> > Do I gain in performance if I manually add together rectangles to be
> > invalidated if I already know that these rectangles are mainly
> > overlapping -
> > rather than calling Invalidate(Rectangle) several times?
> >
> > - Hope that I explain myself
> >
> > Thank you very much!
> > Teis