I have read somewhere that CreateGraphics() will do this steps for us :
- BeginPaint
- Drawing
- EndPaint
I have my code like this :
private void Form1_Load(object sender, EventArgs e)
{
grFrom = this.CreateGraphics();
grFrom.FillRectangle(Brushes.Red, this.ClientRectangle);
}
There is no red rectangle…but, When I copy line below in Form1_paint, every thing runs correctly.
grFrom.FillRectangle(Brushes.Red, this.ClientRectangle);
So Question is Here:
What is the e.Graphics in Form1_paint?
CreateGraphics or e.Graphics?
Two things:
Dispose()prior to exiting. You should put your statement inside of a using block.