I try to draw a table on a panel in C# Windows Form by using GDI+. The problem is that when I minimize the application, my drawing disappears. How can I avoid this and why acting this way?
A:
Everything disappears when you minimize a window. I assume you mean that the table isn't there anymore when you restore the window. That will happen when you don't use the Paint event to draw the table but draw the screen directly. Implement the panel's Paint event:
private void panel1_Paint(object sender, PaintEventArgs e) {
e.Graphics.DrawLine(Pens.Black, 0, 0, panel1.Width, 0);
// etc...
}
Hans Passant
2010-04-10 17:52:55