次の方法で共有


GraphicsPath.AddPie メソッド (Int32, Int32, Int32, Int32, Single, Single)

パスに扇形のアウトラインを追加します。

Overloads Public Sub AddPie( _
   ByVal x As Integer, _   ByVal y As Integer, _   ByVal width As Integer, _   ByVal height As Integer, _   ByVal startAngle As Single, _   ByVal sweepAngle As Single _)
[C#]
public void AddPie(intx,inty,intwidth,intheight,floatstartAngle,floatsweepAngle);
[C++]
public: void AddPie(intx,inty,intwidth,intheight,floatstartAngle,floatsweepAngle);
[JScript]
public function AddPie(
   x : int,y : int,width : int,height : int,startAngle : float,sweepAngle : float);

パラメータ

  • x
    扇形の描画元となる楕円を定義する外接する四角形の左上隅の x 座標。
  • y
    扇形の描画元となる楕円を定義する外接する四角形の左上隅の y 座標。
  • width
    扇形の描画元となる楕円を定義する外接する四角形の幅。
  • height
    扇形の描画元となる楕円を定義する外接する四角形の高さ。
  • startAngle
    x 軸から時計回りに測定した、扇型部分の開始角度。
  • sweepAngle
    startAngle から時計回りで測定した、 startAngle と扇型部分の終端との間の角度。

解説

扇形は、楕円のアウトラインの一部分と、その部分アウトラインの終点と交わる 2 本の半径によって定義されます。部分的なアウトラインは、x 軸から時計回りに測定した startAngle から始まり、 startAngle + sweepAngle で終了します。

使用例

[Visual Basic, C#] 次の例は、Windows フォームでの使用を意図してデザインされており、 OnPaint イベントのオブジェクトである PaintEventArgs e が必要です。このコードはグラフィックス パスを作成し、扇形を追加してから、画面にパスを描画します。

 
Public Sub AddPieExample(e As PaintEventArgs)
' Create a pie slice of a circle using the AddPie method.
Dim myPath As New GraphicsPath()
myPath.AddPie(20, 20, 70, 70, - 45, 90)
' Draw the path to the screen.
Dim myPen As New Pen(Color.Black, 2)
e.Graphics.DrawPath(myPen, myPath)
End Sub
        
[C#] 
private void AddPieExample(PaintEventArgs e)
{
// Create a pie slice of a circle using the AddPie method.
GraphicsPath myPath = new GraphicsPath();
myPath.AddPie(20, 20, 70, 70, -45, 90);
// Draw the path to the screen.
Pen myPen = new Pen(Color.Black, 2);
e.Graphics.DrawPath(myPen, myPath);
}
        

[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 ファミリ

参照

GraphicsPath クラス | GraphicsPath メンバ | System.Drawing.Drawing2D 名前空間 | GraphicsPath.AddPie オーバーロードの一覧