座標ペア、幅、および高さで指定された楕円の一部を表す円弧を描画します。
Overloads Public Sub DrawArc( _
ByVal pen As Pen, _ ByVal x As Single, _ ByVal y As Single, _ ByVal width As Single, _ ByVal height As Single, _ ByVal startAngle As Single, _ ByVal sweepAngle As Single _)
[C#]
public void DrawArc(Penpen,floatx,floaty,floatwidth,floatheight,floatstartAngle,floatsweepAngle);
[C++]
public: void DrawArc(Pen* pen,floatx,floaty,floatwidth,floatheight,floatstartAngle,floatsweepAngle);
[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 パラメータの間の部分です。
使用例
[Visual Basic, C#] 次の例は、Windows フォームでの使用を意図してデザインされており、 Paint イベント ハンドラのパラメータである PaintEventArgs e が必要です。このコードは次のアクションを実行します。
- 黒いペンを作成します。
- 楕円に外接する四角形の位置とサイズを作成します。
- 開始角度 (45 度) とスイープ角度 (270 度) を定義します。
- 画面に楕円の円弧を描画します。
[Visual Basic, C#] x 軸に対して +45 ~ -45 度の間のセグメントがない不完全な楕円が生成されます。
Public Sub DrawArcFloat(e As PaintEventArgs)
' Create pen.
Dim blackPen As New Pen(Color.Black, 3)
' Create coordinates of rectangle to bound ellipse.
Dim x As Single = 0F
Dim y As Single = 0F
Dim width As Single = 100F
Dim height As Single = 200F
' Create start and sweep angles on ellipse.
Dim startAngle As Single = 45F
Dim sweepAngle As Single = 270F
' 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);
}
[C++, JScript] C++ および JScript のサンプルはありません。Visual Basic および C# のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
参照
Graphics クラス | Graphics メンバ | System.Drawing 名前空間 | Graphics.DrawArc オーバーロードの一覧