4个int分别表示矩形的左上角X,Y坐标,矩形的宽和高,C#里面画的椭圆的大小是用矩形来定义的,你定义矩形后,绘制的就是矩形的内切椭圆,后面两个为起始角度和终止角度与起始角度的夹角。
1
2
3
4
5
6
7
8
9
10
11
|
private void Form1_Paint( object sender, PaintEventArgs e) { GraphicsPath path = new GraphicsPath(); path.AddArc(0, 0, 100, 200, 10, 270); e.Graphics.DrawPath( new Pen(Color.Black,1),path); } |
上面的的是一个左上角在(0,0)处,宽和高分别为100,200px的矩形,更改(0,0)就可以在其他地方绘制。
1
2
3
4
5
6
7
8
9
10
11
|
private void Form1_Paint( object sender, PaintEventArgs e) { GraphicsPath path = new GraphicsPath(); path.AddArc(100, 100, 100, 200, 10, 270); e.Graphics.DrawPath( new Pen(Color.Black,1),path); }
|
从椭圆的10度位置开始画,然后画到280度的位置,椭圆其他的部分不画出来