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)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
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 窗体 一起使用,它需要 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)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
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 窗体 一起使用,它需要 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)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
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 窗体 一起使用,它需要 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)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
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 窗体 一起使用,它需要 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边界矩形定义。

适用于