dvanniel Posted November 16, 2003 Posted November 16, 2003 Hi, Just what i was looking for :D But i have one question...how can i get the drawn item to stay on the form? After a minimize/restore the rectangle i've drawn disappears :confused: This i what i've coded now: public void button1_Click(object sender, EventArgs e) { Graphics g = this.CreateGraphics(); DrawTiles.Draw(g, 10.0F, 20.0F, new SolidBrush(Color.Black)); } Where the Draw method is: public static void Draw(Graphics g, float x, float y, SolidBrush brush) { g.FillRectangle (brush, x+1, y+1, 28.0F, 28.0F); } So when the user clicks on button1 then rectangle is drawn, but as i wrote before...the thing disappears after a min/rest. Does anybody know how to handle this? :D Quote
*Experts* mutant Posted November 16, 2003 *Experts* Posted November 16, 2003 (edited) It disappears because you are only drawing it once. When the Paint event for the window occurs, for example min/max the window in your case, everything on the window is redrawn. Since you don't draw it again in the Paint event it will not be drawn again onto the form. Please start a new thread next time instead of digging up old ones. :) Edited November 16, 2003 by mutant Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.