語言

Graphics.DrawEllipse 方法

定義

繪製一個由一對座標、高度和寬度指定的邊界矩形所定義的橢圓。

多載

名稱 Description
DrawEllipse(Pen, Int32, Int32, Int32, Int32)

繪製一個由邊界矩形定義的橢圓,該矩形由矩形左上角的座標、高度和寬度所指定。

DrawEllipse(Pen, Single, Single, Single, Single)

繪製一個由一對座標、高度和寬度指定的邊界矩形所定義的橢圓。

DrawEllipse(Pen, RectangleF)

繪製一個由邊界 RectangleF定義的橢圓。

DrawEllipse(Pen, Rectangle)

繪製一個由邊界 Rectangle 結構指定的橢圓。

DrawEllipse(Pen, Int32, Int32, Int32, Int32)

來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs

繪製一個由邊界矩形定義的橢圓,該矩形由矩形左上角的座標、高度和寬度所指定。

public:
 void DrawEllipse(System::Drawing::Pen ^ pen, int x, int y, int width, int height);
public void DrawEllipse(System.Drawing.Pen pen, int x, int y, int width, int height);
member this.DrawEllipse : System.Drawing.Pen * int * int * int * int -> unit
Public Sub DrawEllipse (pen As Pen, x As Integer, y As Integer, width As Integer, height As Integer)

參數

pen
Pen

Pen 這決定了橢圓的顏色、寬度和樣式。

x
Int32

定義橢圓的邊界矩形左上角的 x 座標。

y
Int32

定義橢圓的邊界矩形左上角的 y 座標。

width
Int32

定義橢圓的邊界矩形寬度。

height
Int32

定義橢圓的邊界矩形高度。

例外狀況

pen 是 null。

範例

以下程式碼範例是為 Windows Forms 設計的,並需要 PaintEventArgse,這是 Paint 事件處理程序的參數。 此程式碼會執行下列動作:

  • 會產生一支黑色筆。

  • 建立矩形的位置與大小,以界定橢圓。

  • 將橢圓畫到螢幕上。

private:
   void DrawEllipseInt( PaintEventArgs^ e )
   {
      // Create pen.
      Pen^ blackPen = gcnew Pen( Color::Black,3.0f );

      // Create location and size of ellipse.
      int x = 0;
      int y = 0;
      int width = 200;
      int height = 100;

      // Draw ellipse to screen.
      e->Graphics->DrawEllipse( blackPen, x, y, width, height );
   }
private void DrawEllipseInt(PaintEventArgs e)
{
    // Create pen.
    Pen blackPen = new Pen(Color.Black, 3);
             
    // Create location and size of ellipse.
    int x = 0;
    int y = 0;
    int width = 200;
    int height = 100;
             
    // Draw ellipse to screen.
    e.Graphics.DrawEllipse(blackPen, x, y, width, height);
}
Private Sub DrawEllipseInt(ByVal e As PaintEventArgs)

    ' Create pen.
    Dim blackPen As New Pen(Color.Black, 3)

    ' Create location and size of ellipse.
    Dim x As Integer = 0
    Dim y As Integer = 0
    Dim width As Integer = 200
    Dim height As Integer = 100

    ' Draw ellipse to screen.
    e.Graphics.DrawEllipse(blackPen, x, y, width, height)
End Sub

備註

此方法繪製一個由 、 x、 y及width參數所描述height的界長方形所定義的橢圓。

適用於

DrawEllipse(Pen, Single, Single, Single, Single)

來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs

繪製一個由一對座標、高度和寬度指定的邊界矩形所定義的橢圓。

public:
 void DrawEllipse(System::Drawing::Pen ^ pen, float x, float y, float width, float height);
public void DrawEllipse(System.Drawing.Pen pen, float x, float y, float width, float height);
member this.DrawEllipse : System.Drawing.Pen * single * single * single * single -> unit
Public Sub DrawEllipse (pen As Pen, x As Single, y As Single, width As Single, height As Single)

參數

pen
Pen

Pen 這決定了橢圓的顏色、寬度和樣式。

x
Single

定義橢圓的邊界矩形左上角的 x 座標。

y
Single

定義橢圓的邊界矩形左上角的 y 座標。

width
Single

定義橢圓的邊界矩形寬度。

height
Single

定義橢圓的邊界矩形高度。

例外狀況

pen 是 null。

範例

以下程式碼範例是為 Windows Forms 設計的,並需要 PaintEventArgse,這是 Paint 事件處理程序的參數。 此程式碼會執行下列動作:

  • 會產生一支黑色筆。

  • 建立矩形的位置與大小,以界定橢圓。

  • 將橢圓畫到螢幕上。

private:
   void DrawEllipseFloat( PaintEventArgs^ e )
   {
      // Create pen.
      Pen^ blackPen = gcnew Pen( Color::Black,3.0f );

      // Create location and size of ellipse.
      float x = 0.0F;
      float y = 0.0F;
      float width = 200.0F;
      float height = 100.0F;

      // Draw ellipse to screen.
      e->Graphics->DrawEllipse( blackPen, x, y, width, height );
   }
private void DrawEllipseFloat(PaintEventArgs e)
{         
    // Create pen.
    Pen blackPen = new Pen(Color.Black, 3);
             
    // Create location and size of ellipse.
    float x = 0.0F;
    float y = 0.0F;
    float width = 200.0F;
    float height = 100.0F;
             
    // Draw ellipse to screen.
    e.Graphics.DrawEllipse(blackPen, x, y, width, height);
}
Private Sub DrawEllipseFloat(ByVal e As PaintEventArgs)

    ' Create pen.
    Dim blackPen As New Pen(Color.Black, 3)

    ' Create location and size of ellipse.
    Dim x As Single = 0.0F
    Dim y As Single = 0.0F
    Dim width As Single = 200.0F
    Dim height As Single = 100.0F

    ' Draw ellipse to screen.
    e.Graphics.DrawEllipse(blackPen, x, y, width, height)
End Sub

備註

此方法繪製一個由 、 x、 y及width參數所描述height的界長方形所定義的橢圓。

適用於

DrawEllipse(Pen, RectangleF)

來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs

繪製一個由邊界 RectangleF定義的橢圓。

public:
 void DrawEllipse(System::Drawing::Pen ^ pen, System::Drawing::RectangleF rect);
public void DrawEllipse(System.Drawing.Pen pen, System.Drawing.RectangleF rect);
member this.DrawEllipse : System.Drawing.Pen * System.Drawing.RectangleF -> unit
Public Sub DrawEllipse (pen As Pen, rect As RectangleF)

參數

pen
Pen

Pen 這決定了橢圓的顏色、寬度和樣式。

rect
RectangleF

RectangleF 定義橢圓邊界的結構。

例外狀況

pen 是 null。

範例

以下程式碼範例是為 Windows Forms 設計的,並需要 PaintEventArgse,這是 Paint 事件處理程序的參數。 此程式碼會執行下列動作:

  • 會產生一支黑色筆。

  • 建立一個矩形來界定橢圓。

  • 將橢圓畫到螢幕上。

private:
   void DrawEllipseRectangleF( PaintEventArgs^ e )
   {
      // Create pen.
      Pen^ blackPen = gcnew Pen( Color::Black,3.0f );

      // Create rectangle for ellipse.
      RectangleF rect = RectangleF(0.0F,0.0F,200.0F,100.0F);

      // Draw ellipse to screen.
      e->Graphics->DrawEllipse( blackPen, rect );
   }
private void DrawEllipseRectangleF(PaintEventArgs e)
{
    // Create pen.
    Pen blackPen = new Pen(Color.Black, 3);
             
    // Create rectangle for ellipse.
    RectangleF rect = new RectangleF(0.0F, 0.0F, 200.0F, 100.0F);
             
    // Draw ellipse to screen.
    e.Graphics.DrawEllipse(blackPen, rect);
}
Private Sub DrawEllipseRectangleF(ByVal e As PaintEventArgs)

    ' Create pen.
    Dim blackPen As New Pen(Color.Black, 3)

    ' Create rectangle for ellipse.
    Dim rect As New RectangleF(0.0F, 0.0F, 200.0F, 100.0F)

    ' Draw ellipse to screen.
    e.Graphics.DrawEllipse(blackPen, rect)
End Sub

備註

此方法繪製一個由參數指定的 rect 邊界矩形定義的橢圓。

適用於

DrawEllipse(Pen, Rectangle)

來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs

繪製一個由邊界 Rectangle 結構指定的橢圓。

public:
 void DrawEllipse(System::Drawing::Pen ^ pen, System::Drawing::Rectangle rect);
public void DrawEllipse(System.Drawing.Pen pen, System.Drawing.Rectangle rect);
member this.DrawEllipse : System.Drawing.Pen * System.Drawing.Rectangle -> unit
Public Sub DrawEllipse (pen As Pen, rect As Rectangle)

參數

pen
Pen

Pen 這決定了橢圓的顏色、寬度和樣式。

rect
Rectangle

Rectangle 定義橢圓邊界的結構。

例外狀況

pen 是 null。

範例

以下程式碼範例是為 Windows Forms 設計的,並需要 PaintEventArgse,這是 Paint 事件處理程序的參數。 此程式碼會執行下列動作:

  • 會產生一支黑色筆。

  • 建立一個矩形來界定橢圓。

  • 將橢圓畫到螢幕上。

private:
   void DrawEllipseRectangle( PaintEventArgs^ e )
   {
      // Create pen.
      Pen^ blackPen = gcnew Pen( Color::Black,3.0f );

      // Create rectangle for ellipse.
      Rectangle rect = Rectangle(0,0,200,100);

      // Draw ellipse to screen.
      e->Graphics->DrawEllipse( blackPen, rect );
   }
private void DrawEllipseRectangle(PaintEventArgs e)
{
    // Create pen.
    Pen blackPen = new Pen(Color.Black, 3);
             
    // Create rectangle for ellipse.
    Rectangle rect = new Rectangle(0, 0, 200, 100);
             
    // Draw ellipse to screen.
    e.Graphics.DrawEllipse(blackPen, rect);
}
Private Sub DrawEllipseRectangle(ByVal e As PaintEventArgs)

    ' Create pen.
    Dim blackPen As New Pen(Color.Black, 3)

    ' Create rectangle for ellipse.
    Dim rect As New Rectangle(0, 0, 200, 100)

    ' Draw ellipse to screen.
    e.Graphics.DrawEllipse(blackPen, rect)
End Sub

備註

此方法繪製一個由參數指定的 rect 邊界矩形定義的橢圓。

適用於