次の方法で共有


GraphicsPath.AddEllipse メソッド (Rectangle)

現在のパスに楕円を追加します。

Overloads Public Sub AddEllipse( _
   ByVal rect As Rectangle _)
[C#]
public void AddEllipse(Rectanglerect);
[C++]
public: void AddEllipse(Rectanglerect);
[JScript]
public function AddEllipse(
   rect : Rectangle);

パラメータ

  • rect
    楕円を定義する外接する四角形を表す Rectangle 構造体。

使用例

[Visual Basic, C#] 次の例は、Windows フォームでの使用を意図してデザインされており、 OnPaint イベントのオブジェクトである PaintEventArgs e が必要です。このコードは次のアクションを実行します。

[Visual Basic, C#] 楕円を定義する外接する四角形を作成します。

[Visual Basic, C#] パスを作成し、そのパスに楕円を追加します。

[Visual Basic, C#] 画面にパスを描画します。

 
Public Sub AddEllipseExample(e As PaintEventArgs)
' Create a path and add an ellipse.
Dim myEllipse As New Rectangle(20, 20, 100, 50)
Dim myPath As New GraphicsPath()
myPath.AddEllipse(myEllipse)
' Draw the path to the screen.
Dim myPen As New Pen(Color.Black, 2)
e.Graphics.DrawPath(myPen, myPath)
End Sub
        
[C#] 
private void AddEllipseExample(PaintEventArgs e)
{
// Create a path and add an ellipse.
Rectangle myEllipse = new Rectangle(20, 20, 100, 50);
GraphicsPath myPath = new GraphicsPath();
myPath.AddEllipse(myEllipse);
// 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.AddEllipse オーバーロードの一覧