求教关于图形的问题
我在private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)函数里绘制了一个图形,如何在private void Form1_SizeChanged(object sender, System.EventArgs e)函数里改变图形的大小? private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { Graphics myGraphics = e.Graphics; Form1 from = new Form1(); int y = from.Size.Height; int x = from.Size.Width-10; Pen myPen= new Pen( Color.Black,2 ); myGraphics.DrawLine(myPen,2,(float)(y*0.2024),x/2,2); myGraphics.DrawLine(myPen,x/2,0,x,(float)(y*0.2024)); myGraphics.DrawLine(myPen,2,(float)(y*0.2024),2,(float)(y*0.745)); myGraphics.DrawLine(myPen,x,(float)(y*0.2024),x,(float)(y*0.745)); myGraphics.DrawEllipse(myPen,2,(float)(y*0.5783),x-2,(float)(y*0.3012)); myGraphics.DrawArc(myPen,2,(float)(y*0.1615),x-2,(float)(y*0.0819),0,180); for(int i = 0,j = -5;i>-180;) { myGraphics.DrawArc(myPen,2,(float)(y*0.1615),x-2,(float)(y*0.0819),i,j); i = i-10; } } |
[此贴子已经被作者于2005-9-16 10:24:23编辑过]