View Single Post
  #1 (permalink)  
Old May 25th, 2005, 07:47 PM
vnt vnt is offline
Registered User
 
Join Date: May 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Graphic disapeared

Hi all,

I have the following code:

private void DrawLine(int pNumber, string pLabel)
{
FontStyle Style = FontStyle.Regular;
Font Arial = new Font(new FontFamily("Arial"), 9, Style);
Graphics Graph = this.CreateGraphics();
SolidBrush Brush = new SolidBrush(Color.Blue);
Pen MyPen = new Pen(Color.LightBlue);

Graphics Graphics = this.CreateGraphics();
Graphics.DrawString(pLabel, lArial, Brush, mXOffset, mYOffSet + 2);
Graphics.DrawRectangle(MyPen, mXOffset, mYOffSet, mWidthText, mHeigh);
// ....
}

When use these to draw something in a Form. They are ok (visible)
but when i minimize and maximize, all graphics disapeared.

Why is that? is that b/c they are created in a local function?


Thank you
Trevor
Reply With Quote