How to restore the background behind a drawn rectangle?

Con risposta How to restore the background behind a drawn rectangle?

  • sabato 14 aprile 2012 08:43
     
     

    Hi everyone,

    In my application I need to draw several filled rectangles on a panel with a tiled background image. Depending on user actions, certain - not all - rectangles must be removed afterwards, revealing the background image again. Drawing and filling the rectangles is not so difficult, but how can I remove them in such a way that the background gets restored correctly?

    Thank you,

    Cooz

Tutte le risposte

  • sabato 14 aprile 2012 09:11
     
     Con risposta
    Stop drawing them.  Put the rectangles in a List(of Rectangle) and remove them when you when you don't want them drawn.  Iterate through the list in the Paint event to draw the rectangles.
    • Contrassegnato come risposta Cooz2 lunedì 16 aprile 2012 13:58
    •  
  • lunedì 16 aprile 2012 14:01
     
     

    Hi John,

    Yep, that works. "Stop drawing them ... draw the rectangles." had me a little puzzled at first though.

    Thanks!

    Cooz