Repaint form using Invalidate()
-
I need to know how to re-draw graphics on my forms when the forms are minimized or lose focus. I know there are an Update() and Invalidate() method but when I use them they don't work. I need to know where to put them actually. I already know that the OnPaint() method is called when the form loses focus and graphics need to be drawn. The reason i don't want to go that route is because I am using a button control that when pressed, there are counters that will change the coordinates of the graphic shape. This means I would have to save the current state or coordinates after each time the button is pressed and it would be a hassle to pass all of this to the OnPaint() method, even though it could be done. I just need a simple way to redraw my graphics in the forms.
-
I need to know how to re-draw graphics on my forms when the forms are minimized or lose focus. I know there are an Update() and Invalidate() method but when I use them they don't work. I need to know where to put them actually. I already know that the OnPaint() method is called when the form loses focus and graphics need to be drawn. The reason i don't want to go that route is because I am using a button control that when pressed, there are counters that will change the coordinates of the graphic shape. This means I would have to save the current state or coordinates after each time the button is pressed and it would be a hassle to pass all of this to the OnPaint() method, even though it could be done. I just need a simple way to redraw my graphics in the forms.
save all the graphics in an ArrayList make some class like Elipse , Arc.. etc OnPaint() foreach ( drawing in myDrawings ) { drawing.Draw( e.Grahics ) ; } Lazar Mihai Highschool student