GraphicsPath.AddArc 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將橢圓弧形附加到目前的圖形。
多載
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 軸順時針測量,以開始角度的度數) ) 。 藉由以掃掠角度的度數,從起點以順時針方式測量端點,同樣地找到端點。 如果掃掠角度大於 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 軸順時針測量,以開始角度的度數) ) 。 藉由以掃掠角度的度數,從起點以順時針方式測量端點,同樣地找到端點。 如果掃掠角度大於 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
定義從 0 度到 180 度掃掠的 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 軸順時針測量,以開始角度的度數) ) 。 藉由以掃掠角度的度數,從起點以順時針方式測量端點,同樣地找到端點。 如果掃掠角度大於 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
RectangleF,表示用來取得弧形之橢圓形的矩形界限。
- startAngle
- Single
弧形的開始點角度,順時針自 X 軸所測得的度數。
- sweepAngle
- Single
介於弧形的 startAngle
和結束點的角度。
範例
如需範例,請參閱 AddArc(Rectangle, Single, Single)。
備註
如果圖表中有前一條線或曲線,則會新增線條,以將前一個線段的端點連接到弧線的開頭。
弧形會沿著指定的矩形所系結的橢圓形周框進行追蹤。 弧線的起點是由從橢圓形 (的 x 軸順時針測量,以開始角度的度數) ) 。 藉由以掃掠角度的度數,從起點以順時針方式測量端點,同樣地找到端點。 如果掃掠角度大於 360 度或小於 -360 度,則弧形會分別由 360 度或 -360 度掃掠。
適用於
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應