关于Graghics的问题
为什么以下代码放在Form1_Load(object sender,System.EventArgs e)中,窗体中什么也没有?
Graphics graphics=this.CreateGraphics ();
graphics.Clear (Color.Black );
Pen blakpen=new Pen (Color.Red ,10);
float x=10.0f;
float y=20.0f;
float width=200.0f;
float height=50.0f;
Pen red=new Pen (Color.Red ,3);
Pen blue=new Pen (Color.Blue ,3);
graphics.DrawLine (red,10,100,200,100);
graphics.DrawLine (blue,10,100,200,1);
graphics.DrawLine (blakpen,x,y,width,height);
放在Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)中有效果?