C# public void DrawArc ( Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle )
C++ public: void DrawArc ( Pen^ pen, float x, float y, float width, float height, float startAngle, float sweepAngle )
J# public void DrawArc ( Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle )
JScript public function DrawArc ( pen : Pen, x : float, y : float, width : float, height : float, startAngle : float, sweepAngle : float )
参数 pen Pen,它确定弧线的颜色、宽度和样式。 x 定义椭圆的矩形的左上角的 x 坐标。 y 定义椭圆的矩形的左上角的 y 坐标。 width 定义椭圆的矩形的宽度。 height 定义椭圆的矩形的高度。 startAngle 从 x 轴到弧线的起始点沿顺时针方向度量的角(以度为单位)。 sweepAngle 从 startAngle 参数到弧线的结束点沿顺时针方向度量的角(以度为单位)。 备注 此方法绘制一段弧线,它是椭圆周边的一部分。该椭圆由矩形的边界定义。弧线是椭圆周长中位于 startAngle 参数和 startAngle+ sweepAngle 参数之间的部分。示例 下面的代码示例设计为与 Windows 窗体一起使用,它需要 PaintEventArgse,即 Paint 事件处理程序的一个参数。代码执行下列操作: 创建黑色钢笔。创建限定椭圆的矩形的位置和大小。定义起始角(45 度)和扫过的角度(270 度)。将椭圆弧线绘制到屏幕。结果是部分椭圆,缺少 x 轴两侧 + 45 度和 - 45 度之间的部分。Visual Basic 复制代码 Public Sub DrawArcFloat(ByVal e As PaintEventArgs) ' Create pen. Dim blackPen As New Pen(Color.Black, 3) ' Create coordinates of rectangle to bound ellipse. Dim x As Single = 0.0F Dim y As Single = 0.0F Dim width As Single = 100.0F Dim height As Single = 200.0F ' Create start and sweep angles on ellipse. Dim startAngle As Single = 45.0F Dim sweepAngle As Single = 270.0F ' Draw arc to screen. e.Graphics.DrawArc(blackPen, x, y, width, height, startAngle, _ sweepAngle) End Sub C# 复制代码 public void DrawArcFloat(PaintEventArgs e) { // Create pen. Pen blackPen= new Pen(Color.Black, 3);
// Create coordinates of rectangle to bound ellipse. float x = 0.0F; float y = 0.0F; float width = 100.0F; float height = 200.0F;
// Create start and sweep angles on ellipse. float startAngle = 45.0F; float sweepAngle = 270.0F;
// Draw arc to screen. e.Graphics.DrawArc(blackPen, x, y, width, height, startAngle, sweepAngle); }
public void DrawArc (
Pen pen,
float x,
float y,
float width,
float height,
float startAngle,
float sweepAngle
)
C++
public:
void DrawArc (
Pen^ pen,
float x,
float y,
float width,
float height,
float startAngle,
float sweepAngle
)
J#
public void DrawArc (
Pen pen,
float x,
float y,
float width,
float height,
float startAngle,
float sweepAngle
)
JScript
public function DrawArc (
pen : Pen,
x : float,
y : float,
width : float,
height : float,
startAngle : float,
sweepAngle : float
)
参数
pen
Pen,它确定弧线的颜色、宽度和样式。 x
定义椭圆的矩形的左上角的 x 坐标。 y
定义椭圆的矩形的左上角的 y 坐标。 width
定义椭圆的矩形的宽度。 height
定义椭圆的矩形的高度。 startAngle
从 x 轴到弧线的起始点沿顺时针方向度量的角(以度为单位)。 sweepAngle
从 startAngle 参数到弧线的结束点沿顺时针方向度量的角(以度为单位)。
备注
此方法绘制一段弧线,它是椭圆周边的一部分。该椭圆由矩形的边界定义。弧线是椭圆周长中位于 startAngle 参数和 startAngle+ sweepAngle 参数之间的部分。示例
下面的代码示例设计为与 Windows 窗体一起使用,它需要 PaintEventArgse,即 Paint 事件处理程序的一个参数。代码执行下列操作: 创建黑色钢笔。创建限定椭圆的矩形的位置和大小。定义起始角(45 度)和扫过的角度(270 度)。将椭圆弧线绘制到屏幕。结果是部分椭圆,缺少 x 轴两侧 + 45 度和 - 45 度之间的部分。Visual Basic 复制代码
Public Sub DrawArcFloat(ByVal e As PaintEventArgs) ' Create pen.
Dim blackPen As New Pen(Color.Black, 3) ' Create coordinates of rectangle to bound ellipse.
Dim x As Single = 0.0F
Dim y As Single = 0.0F
Dim width As Single = 100.0F
Dim height As Single = 200.0F ' Create start and sweep angles on ellipse.
Dim startAngle As Single = 45.0F
Dim sweepAngle As Single = 270.0F ' Draw arc to screen.
e.Graphics.DrawArc(blackPen, x, y, width, height, startAngle, _
sweepAngle)
End Sub
C# 复制代码
public void DrawArcFloat(PaintEventArgs e)
{
// Create pen.
Pen blackPen= new Pen(Color.Black, 3);
// Create coordinates of rectangle to bound ellipse.
float x = 0.0F;
float y = 0.0F;
float width = 100.0F;
float height = 200.0F;
// Create start and sweep angles on ellipse.
float startAngle = 45.0F;
float sweepAngle = 270.0F;
// Draw arc to screen.
e.Graphics.DrawArc(blackPen, x, y, width, height, startAngle, sweepAngle);
}