Erasing rectangle drawn with DrawRectangle

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to use Graphics.DrawRectangle to draw a rectangle at a position on the
screen, and then a few seconds later, erase it. How do you erase a rectangle
that you just drew (without affecting the original background of the
window(s) behind the rectangle)?

Thanks...

Dan
 
Dan said:
I want to use Graphics.DrawRectangle to draw a rectangle at a position on the
screen, and then a few seconds later, erase it. How do you erase a rectangle
that you just drew (without affecting the original background of the
window(s) behind the rectangle)?

Thanks...

Dan


If you force the background object (form, control, etc) to repaint
itself. You can use the invalidate method I believe.

Chris
 
I want to use Graphics.DrawRectangle to draw a rectangle at a position on
the
screen, and then a few seconds later, erase it. How do you erase a rectangle
that you just drew (without affecting the original background of the
window(s) behind the rectangle)?

Try ControlPaint.DrawReversibleFrame. Call it once to draw, call it again
with the same args to erase. The disadvantage is that you can't precisely
control the rectangle's color.
 

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

Back
Top