Share via


Graphics.FillEllipse 方法

定義

填滿由座標對、寬度和高度指定的周框所定義的橢圓形內部。

多載

FillEllipse(Brush, Rectangle)

填滿由 Rectangle 結構指定的周框所定義的橢圓形內部。

FillEllipse(Brush, RectangleF)

填滿由 RectangleF 結構指定的周框所定義的橢圓形內部。

FillEllipse(Brush, Int32, Int32, Int32, Int32)

填滿由座標對、寬度和高度指定的周框所定義的橢圓形內部。

FillEllipse(Brush, Single, Single, Single, Single)

填滿由座標對、寬度和高度指定的周框所定義的橢圓形內部。

FillEllipse(Brush, Rectangle)

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

填滿由 Rectangle 結構指定的周框所定義的橢圓形內部。

public:
 void FillEllipse(System::Drawing::Brush ^ brush, System::Drawing::Rectangle rect);
public void FillEllipse (System.Drawing.Brush brush, System.Drawing.Rectangle rect);
member this.FillEllipse : System.Drawing.Brush * System.Drawing.Rectangle -> unit
Public Sub FillEllipse (brush As Brush, rect As Rectangle)

參數

brush
Brush

Brush,決定填滿的特性。

rect
Rectangle

Rectangle 結構,表示定義橢圓形的周框。

例外狀況

brushnull

範例

下列程式代碼範例是專為搭配 Windows Forms 使用而設計,而且需要 PaintEventArgse,這是事件處理程式的參數Paint。 此程式碼會執行下列動作:

  • 建立純紅色筆刷。

  • 建立限定橢圓形的矩形。

  • 填滿螢幕上的省略號。

public:
   void FillEllipseRectangle( PaintEventArgs^ e )
   {
      // Create solid brush.
      SolidBrush^ redBrush = gcnew SolidBrush( Color::Red );

      // Create rectangle for ellipse.
      int x = 0;
      int y = 0;
      int width = 200;
      int height = 100;
      Rectangle rect = Rectangle(x,y,width,height);

      // Fill ellipse on screen.
      e->Graphics->FillEllipse( redBrush, rect );
   }
public void FillEllipseRectangle(PaintEventArgs e)
{
             
    // Create solid brush.
    SolidBrush redBrush = new SolidBrush(Color.Red);
             
    // Create rectangle for ellipse.
    int x = 0;
    int y = 0;
    int width = 200;
    int height = 100;
    Rectangle rect = new Rectangle(x, y, width, height);
             
    // Fill ellipse on screen.
    e.Graphics.FillEllipse(redBrush, rect);
}
Public Sub FillEllipseRectangle(ByVal e As PaintEventArgs)

    ' Create solid brush.
    Dim redBrush As New SolidBrush(Color.Red)

    ' Create rectangle for ellipse.
    Dim x As Integer = 0
    Dim y As Integer = 0
    Dim width As Integer = 200
    Dim height As Integer = 100
    Dim rect As New Rectangle(x, y, width, height)

    ' Fill ellipse on screen.
    e.Graphics.FillEllipse(redBrush, rect)
End Sub

備註

這個方法會將省略號 Brush的內部填入 。 省略號是由 參數所代表 rect 的周框所定義。

適用於

FillEllipse(Brush, RectangleF)

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

填滿由 RectangleF 結構指定的周框所定義的橢圓形內部。

public:
 void FillEllipse(System::Drawing::Brush ^ brush, System::Drawing::RectangleF rect);
public void FillEllipse (System.Drawing.Brush brush, System.Drawing.RectangleF rect);
member this.FillEllipse : System.Drawing.Brush * System.Drawing.RectangleF -> unit
Public Sub FillEllipse (brush As Brush, rect As RectangleF)

參數

brush
Brush

Brush,決定填滿的特性。

rect
RectangleF

RectangleF 結構,表示定義橢圓形的周框。

例外狀況

brushnull

範例

下列程式代碼範例是專為搭配 Windows Forms 使用而設計,而且需要 PaintEventArgse,這是事件處理程式的參數Paint。 此程式碼會執行下列動作:

  • 建立純紅色筆刷。

  • 建立限定橢圓形的矩形。

  • 填滿螢幕上的省略號。

public:
   void FillEllipseRectangleF( PaintEventArgs^ e )
   {
      // Create solid brush.
      SolidBrush^ redBrush = gcnew SolidBrush( Color::Red );

      // Create rectangle for ellipse.
      float x = 0.0F;
      float y = 0.0F;
      float width = 200.0F;
      float height = 100.0F;
      RectangleF rect = RectangleF(x,y,width,height);

      // Fill ellipse on screen.
      e->Graphics->FillEllipse( redBrush, rect );
   }
public void FillEllipseRectangleF(PaintEventArgs e)
{
             
    // Create solid brush.
    SolidBrush redBrush = new SolidBrush(Color.Red);
             
    // Create rectangle for ellipse.
    float x = 0.0F;
    float y = 0.0F;
    float width = 200.0F;
    float height = 100.0F;
    RectangleF rect = new RectangleF(x, y, width, height);
             
    // Fill ellipse on screen.
    e.Graphics.FillEllipse(redBrush, rect);
}
Public Sub FillEllipseRectangleF(ByVal e As PaintEventArgs)

    ' Create solid brush.
    Dim redBrush As New SolidBrush(Color.Red)

    ' Create rectangle for 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
    Dim rect As New RectangleF(x, y, width, height)

    ' Fill ellipse on screen.
    e.Graphics.FillEllipse(redBrush, rect)
End Sub

備註

這個方法會將省略號 Brush的內部填入 。 省略號是由 參數所代表 rect 的周框所定義。

適用於

FillEllipse(Brush, Int32, Int32, Int32, Int32)

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

填滿由座標對、寬度和高度指定的周框所定義的橢圓形內部。

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

參數

brush
Brush

Brush,決定填滿的特性。

x
Int32

週框左上角的 X 軸座標,這個週框定義橢圓形。

y
Int32

週框左上角的 Y 軸座標,這個週框定義橢圓形。

width
Int32

週框的寬度,這個週框定義橢圓形。

height
Int32

週框的高度,這個週框定義橢圓形。

例外狀況

brushnull

範例

下列程式代碼範例是專為搭配 Windows Forms 使用而設計,而且需要 PaintEventArgse,這是事件處理程式的參數Paint。 此程式碼會執行下列動作:

  • 建立純紅色筆刷。

  • 建立限定橢圓形的矩形位置和大小。

  • 填滿螢幕上的省略號。

public:
   void FillEllipseInt( PaintEventArgs^ e )
   {
      // Create solid brush.
      SolidBrush^ redBrush = gcnew SolidBrush( Color::Red );

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

      // Fill ellipse on screen.
      e->Graphics->FillEllipse( redBrush, x, y, width, height );
   }
public void FillEllipseInt(PaintEventArgs e)
{
             
    // Create solid brush.
    SolidBrush redBrush = new SolidBrush(Color.Red);
             
    // Create location and size of ellipse.
    int x = 0;
    int y = 0;
    int width = 200;
    int height = 100;
             
    // Fill ellipse on screen.
    e.Graphics.FillEllipse(redBrush, x, y, width, height);
}
Public Sub FillEllipseInt(ByVal e As PaintEventArgs)

    ' Create solid brush.
    Dim redBrush As New SolidBrush(Color.Red)

    ' 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

    ' Fill ellipse on screen.
    e.Graphics.FillEllipse(redBrush, x, y, width, height)
End Sub

備註

這個方法會將省略號 Brush的內部填入 。 省略號是由 、ywidthheight 參數所代表x的周框所定義。

適用於

FillEllipse(Brush, Single, Single, Single, Single)

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

填滿由座標對、寬度和高度指定的周框所定義的橢圓形內部。

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

參數

brush
Brush

Brush,決定填滿的特性。

x
Single

週框左上角的 X 軸座標,這個週框定義橢圓形。

y
Single

週框左上角的 Y 軸座標,這個週框定義橢圓形。

width
Single

週框的寬度,這個週框定義橢圓形。

height
Single

週框的高度,這個週框定義橢圓形。

例外狀況

brushnull

範例

下列程式代碼範例是專為搭配 Windows Forms 使用而設計,而且需要 PaintEventArgse,這是事件處理程式的參數Paint。 此程式碼會執行下列動作:

  • 建立純紅色筆刷。

  • 建立限定橢圓形的矩形位置和大小。

  • 填滿螢幕上的省略號。

public:
   void FillEllipseFloat( PaintEventArgs^ e )
   {
      // Create solid brush.
      SolidBrush^ redBrush = gcnew SolidBrush( Color::Red );

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

      // Fill ellipse on screen.
      e->Graphics->FillEllipse( redBrush, x, y, width, height );
   }
public void FillEllipseFloat(PaintEventArgs e)
{
             
    // Create solid brush.
    SolidBrush redBrush = new SolidBrush(Color.Red);
             
    // Create location and size of ellipse.
    float x = 0.0F;
    float y = 0.0F;
    float width = 200.0F;
    float height = 100.0F;
             
    // Fill ellipse on screen.
    e.Graphics.FillEllipse(redBrush, x, y, width, height);
}
Public Sub FillEllipseFloat(ByVal e As PaintEventArgs)

    ' Create solid brush.
    Dim redBrush As New SolidBrush(Color.Red)

    ' 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

    ' Fill ellipse on screen.
    e.Graphics.FillEllipse(redBrush, x, y, width, height)
End Sub

備註

這個方法會將省略號 Brush的內部填入 。 省略號是由 、ywidthheight 參數所代表x的周框所定義。

適用於