Where to redraw a region of an image drawed in OnPaint() ?

M

mind_the_gap

Hi there,

in my application I visualize a lot of data which often takes a
moment (like 4 seconds in some cases). For drawing everything I have
overriden the OnPaint-Method of a control. In this method I call all
the parts of the app with the graphics object and other stuff as
parameters to let the parts handle their drawing by themselfs.
Now I often use InvalidateRegion a lot to invalidate only parts of
everything. This works fine in a sense of refreshing only the region
on sceen. Under the hood it still recalculates everything (at least in
some cases - if applicable some image buffer is hold by the different
parts). It would be much better to recalculate only the parts which
are actually invalidated and to BitBlt (I guess thats used by
DrawImage, isn't it?) only the regions that are invalidated.

But how to get the information in the drawing routine? I did not found
any property that tells the current OnPaint-Call which regions to
redraw. Have you any suggestions on how to get this information?
 
P

Paul G. Tobey [eMVP]

Hmmm. When I look up OnPaint() in the help, it seems that a PaintEventArgs
object is passed. When I look that up in the help, there is a ClipRectangle
property to it. It's not region-based, of course, but the bounding
rectangle might help you... It also looks like the Graphics property of the
event arguments has a Clip property that would contain the region to paint.

Paul T.
 
M

mind_the_gap

Thank you very much Paul. I thought I looked everywhere at least
twice, but I have missed that. Exactly what I was looking for :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top