日期:2014-05-17  浏览次数:21028 次

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);
}