Invalidate a section of a graphics object

L

Logan

I am writting an application in C# that draws a square under your mouse
whenever you move it. I created a graphics object of the "desktop" and i
can draw on it without problem but i can't figure out how to erase the old
boxes when the mouse is moved. I imagine there must be a way to invalidate
a rectangle of a graphics object but i haven't found a way.

Thanks in advance,
~Logan

Here is the code i use to get the graphics object for the "desktop"
 
R

Robby

One way to do this is to set a clipping region on the Graphics object. One
method of setting a clipping region requires that you use a Region object.
Take a look at this object and the Graphics.Clip property.

Robby
 

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