Drawing multiple rectangles
-
HI Hi, I have requirement where when I click a button a rectangle should be displayed. One more click on the button 1 more rectangle shoud be drawn, without over writing my previous rectangle. In the code which I have the rectangle is getting overwritten which i dont want. Thanks i advance
-
HI Hi, I have requirement where when I click a button a rectangle should be displayed. One more click on the button 1 more rectangle shoud be drawn, without over writing my previous rectangle. In the code which I have the rectangle is getting overwritten which i dont want. Thanks i advance
-
HI Hi, I have requirement where when I click a button a rectangle should be displayed. One more click on the button 1 more rectangle shoud be drawn, without over writing my previous rectangle. In the code which I have the rectangle is getting overwritten which i dont want. Thanks i advance
two options for you to consider. 1. Keep a 'Global' Graphics class that you do all your drawing to. then in your paint event (assuming your doing that way with a panel?) just draw the graphics class. 2. Keep a Collection of rectangles, in which you add a new one to it each time the button is clicked(with desired location, size, colour etc.) then in you paint event just draw each rectangle in the collection Option 2 is a much better solution because you can manipulate rectangles individually if future developments require
Life goes very fast. Tomorrow, today is already yesterday.
-
HI Hi, I have requirement where when I click a button a rectangle should be displayed. One more click on the button 1 more rectangle shoud be drawn, without over writing my previous rectangle. In the code which I have the rectangle is getting overwritten which i dont want. Thanks i advance
What about using STACK structure to store the rect you need to draw? So the latest one will alway be displayed firtly. :)
:) I Love KongFu~