读书人

C#AddArc函数中的参数有关问题

发布时间: 2012-09-21 15:47:26 作者: rapoo

C#AddArc函数中的参数问题
这个函数的这两角度的参数怎么设定啊?纠结了很久都不知道怎么算的。

[解决办法]
给个MSDN的参考:
创建一个矩形,要从该矩形定义弧。
创建路径 myPath。
定义一段 180 度的椭圆弧,它扫过从 0 度 180 度并将其追加到路径。
将路径绘制到屏幕。

C# code
private void AddArcExample(PaintEventArgs e){    // Create a GraphicsPath object.    GraphicsPath myPath = new GraphicsPath();    // Set up and call AddArc, and close the figure.    Rectangle rect = new Rectangle(20, 20, 50, 100);    myPath.StartFigure();    myPath.AddArc(rect, 0, 180);    myPath.CloseFigure();    // Draw the path to screen.    e.Graphics.DrawPath(new Pen(Color.Red, 3), myPath);} 

读书人网 >C#

热点推荐