首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

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

2012-09-21 
C#AddArc函数中的参数问题这个函数的这两角度的参数怎么设定啊?纠结了很久都不知道怎么算的。[解决办法]给

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

热点排行