GraphicsPath.AddArc 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
在當前圖形上附加一個橢圓弧。
多載
| 名稱 | Description |
|---|---|
| AddArc(Single, Single, Single, Single, Single, Single) |
在當前圖形上附加一個橢圓弧。 |
| AddArc(Int32, Int32, Int32, Int32, Single, Single) |
在當前圖形上附加一個橢圓弧。 |
| AddArc(Rectangle, Single, Single) |
在當前圖形上附加一個橢圓弧。 |
| AddArc(RectangleF, Single, Single) |
在當前圖形上附加一個橢圓弧。 |
AddArc(Single, Single, Single, Single, Single, Single)
在當前圖形上附加一個橢圓弧。
public:
void AddArc(float x, float y, float width, float height, float startAngle, float sweepAngle);
public void AddArc(float x, float y, float width, float height, float startAngle, float sweepAngle);
member this.AddArc : single * single * single * single * single * single -> unit
Public Sub AddArc (x As Single, y As Single, width As Single, height As Single, startAngle As Single, sweepAngle As Single)
參數
- x
- Single
定義弧線所取的橢圓的矩形區域左上角的 x 座標。
- y
- Single
定義弧線所從的橢圓的矩形區域左上角的 y 座標。
- width
- Single
定義弧線所取的橢圓的矩形區域寬度。
- height
- Single
定義橢圓的矩形區域高度,該橢圓是從弧線繪製的。
- startAngle
- Single
弧線的起始角度,從 x 軸順時針方向測量。
- sweepAngle
- Single
弧線與終點之間的 startAngle 角度。
範例
如需範例,請參閱 AddArc(Rectangle, Single, Single)。
備註
若圖中有先前的線條或曲線,則會加一條線將前一段線段的端點連接到弧的起點。
該弧線沿著橢圓的周邊描繪,該橢圓被指定矩形所界定。 弧的起點是從橢圓的 x 軸(0 度角)順時針測量起始角度的度數來決定。 端點同樣是從起點順時針測量掃角的度數。 如果掃掠角大於360度或小於 -360 度,則弧線分別被掃掠360度或 -360 度。
適用於
AddArc(Int32, Int32, Int32, Int32, Single, Single)
在當前圖形上附加一個橢圓弧。
public:
void AddArc(int x, int y, int width, int height, float startAngle, float sweepAngle);
public void AddArc(int x, int y, int width, int height, float startAngle, float sweepAngle);
member this.AddArc : int * int * int * int * single * single -> unit
Public Sub AddArc (x As Integer, y As Integer, width As Integer, height As Integer, startAngle As Single, sweepAngle As Single)
參數
- x
- Int32
定義弧線所取的橢圓的矩形區域左上角的 x 座標。
- y
- Int32
定義弧線所從的橢圓的矩形區域左上角的 y 座標。
- width
- Int32
定義弧線所取的橢圓的矩形區域寬度。
- height
- Int32
定義橢圓的矩形區域高度,該橢圓是從弧線繪製的。
- startAngle
- Single
弧線的起始角度,從 x 軸順時針方向測量。
- sweepAngle
- Single
弧線與終點之間的 startAngle 角度。
範例
如需範例,請參閱 AddArc(Rectangle, Single, Single)。
備註
若圖中有先前的線條或曲線,則會加一條線將前一段線段的端點連接到弧的起點。
該弧線沿著橢圓的周邊描繪,該橢圓被指定矩形所界定。 弧的起點是從橢圓的 x 軸(0 度角)順時針測量起始角度的度數來決定。 端點同樣是從起點順時針測量掃角的度數。 如果掃掠角大於360度或小於 -360 度,則弧線分別被掃掠360度或 -360 度。
適用於
AddArc(Rectangle, Single, Single)
在當前圖形上附加一個橢圓弧。
public:
void AddArc(System::Drawing::Rectangle rect, float startAngle, float sweepAngle);
public void AddArc(System.Drawing.Rectangle rect, float startAngle, float sweepAngle);
member this.AddArc : System.Drawing.Rectangle * single * single -> unit
Public Sub AddArc (rect As Rectangle, startAngle As Single, sweepAngle As Single)
參數
- startAngle
- Single
弧線的起始角度,從 x 軸順時針方向測量。
- sweepAngle
- Single
弧線與終點之間的 startAngle 角度。
範例
以下程式碼範例是為 Windows Forms 設計,並需要 PaintEventArgse,一個 OnPaint 事件物件。 此程式碼會執行下列動作:
形成一個矩形,弧線由此定義。
創造一條路徑,
myPath。定義一條180度橢圓弧,從0度掃到180度,並附加於路徑上。
畫出通往螢幕的路徑。
private:
void AddArcExample( PaintEventArgs^ e )
{
// Create a GraphicsPath object.
GraphicsPath^ myPath = gcnew GraphicsPath;
// Set up and call AddArc, and close the figure.
Rectangle rect = Rectangle(20,20,50,100);
myPath->StartFigure();
myPath->AddArc( rect, 0, 180 );
myPath->CloseFigure();
// Draw the path to screen.
e->Graphics->DrawPath( gcnew Pen( Color::Red,3.0f ), myPath );
}
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);
}
Public Sub AddArcExample(ByVal e As PaintEventArgs)
' Create a GraphicsPath object.
Dim myPath As New GraphicsPath
' Set up and call AddArc, and close the figure.
Dim rect As 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)
End Sub
備註
若圖中有先前的線條或曲線,則會加一條線將前一段線段的端點連接到弧的起點。
該弧線沿著橢圓的周邊描繪,該橢圓被指定矩形所界定。 弧的起點是從橢圓的 x 軸(0 度角)順時針測量起始角度的度數來決定。 端點同樣是從起點順時針測量掃角的度數。 如果掃掠角大於360度或小於 -360 度,則弧線分別被掃掠360度或 -360 度。
適用於
AddArc(RectangleF, Single, Single)
在當前圖形上附加一個橢圓弧。
public:
void AddArc(System::Drawing::RectangleF rect, float startAngle, float sweepAngle);
public void AddArc(System.Drawing.RectangleF rect, float startAngle, float sweepAngle);
member this.AddArc : System.Drawing.RectangleF * single * single -> unit
Public Sub AddArc (rect As RectangleF, startAngle As Single, sweepAngle As Single)
參數
- rect
- RectangleF
A RectangleF 代表橢圓的矩形邊界,該橢圓是取弧的來源。
- startAngle
- Single
弧線的起始角度,從 x 軸順時針方向測量。
- sweepAngle
- Single
弧線與終點之間的 startAngle 角度。
範例
如需範例,請參閱 AddArc(Rectangle, Single, Single)。
備註
若圖中有先前的線條或曲線,則會加一條線將前一段線段的端點連接到弧的起點。
該弧線沿著橢圓的周邊描繪,該橢圓被指定矩形所界定。 弧的起點是從橢圓的 x 軸(0 度角)順時針測量起始角度的度數來決定。 端點同樣是從起點順時針測量掃角的度數。 如果掃掠角大於360度或小於 -360 度,則弧線分別被掃掠360度或 -360 度。