Graphics.FillPie 方法

定义

填充由一对坐标、一个宽度、一个高度以及两条射线指定的椭圆所定义的扇形区的内部。

重载

FillPie(Brush, Rectangle, Single, Single)

填充椭圆所定义的扇形区的内部,该椭圆由 RectangleF 结构和两条射线指定。

FillPie(Brush, RectangleF, Single, Single)

填充由椭圆和两条径向线定义的饼图部分的内部。

FillPie(Brush, Int32, Int32, Int32, Int32, Int32, Int32)

填充由一对坐标、一个宽度、一个高度以及两条射线指定的椭圆所定义的扇形区的内部。

FillPie(Brush, Single, Single, Single, Single, Single, Single)

填充由一对坐标、一个宽度、一个高度以及两条射线指定的椭圆所定义的扇形区的内部。

FillPie(Brush, Rectangle, Single, Single)

填充椭圆所定义的扇形区的内部,该椭圆由 RectangleF 结构和两条射线指定。

public:
 void FillPie(System::Drawing::Brush ^ brush, System::Drawing::Rectangle rect, float startAngle, float sweepAngle);
public void FillPie (System.Drawing.Brush brush, System.Drawing.Rectangle rect, float startAngle, float sweepAngle);
member this.FillPie : System.Drawing.Brush * System.Drawing.Rectangle * single * single -> unit
Public Sub FillPie (brush As Brush, rect As Rectangle, startAngle As Single, sweepAngle As Single)

参数

brush
Brush

确定填充特性的 Brush

rect
Rectangle

Rectangle 结构,它表示定义该扇形区所属的椭圆的边框。

startAngle
Single

从 x 轴沿顺时针方向旋转到扇形区第一个边所测得的角度(以度为单位)。

sweepAngle
Single

startAngle 参数沿顺时针方向旋转到扇形区第二个边所测得的角度(以度为单位)。

例外

brushnull

示例

下面的代码示例旨在与 Windows 窗体 一起使用,它需要 PaintEventArgse,这是事件处理程序的参数Paint。 此代码执行以下操作:

  • 创建纯红色画笔。

  • 创建一个绑定椭圆的矩形。

  • 定义相对于 x 轴) 的起始角度 (,扫描角度 (顺时针方向) 。

  • 填充屏幕上椭圆的饼形区域。

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

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

      // Create start and sweep angles.
      float startAngle = 0.0F;
      float sweepAngle = 45.0F;

      // Fill pie to screen.
      e->Graphics->FillPie( redBrush, rect, startAngle, sweepAngle );
   }
public void FillPieRectangle(PaintEventArgs e)
{
             
    // Create solid brush.
    SolidBrush redBrush = new SolidBrush(Color.Red);
             
    // Create rectangle for ellipse.
    Rectangle rect = new Rectangle(0, 0, 200, 100);
             
    // Create start and sweep angles.
    float startAngle =  0.0F;
    float sweepAngle = 45.0F;
             
    // Fill pie to screen.
    e.Graphics.FillPie(redBrush, rect, startAngle, sweepAngle);
}
Public Sub FillPieRectangle(ByVal e As PaintEventArgs)

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

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

    ' Create start and sweep angles.
    Dim startAngle As Single = 0.0F
    Dim sweepAngle As Single = 45.0F

    ' Fill pie to screen.
    e.Graphics.FillPie(redBrush, rect, startAngle, sweepAngle)
End Sub

注解

此方法填充由椭圆弧定义的饼图部分的内部,以及与弧线端点相交的两条径向线。椭圆由边界矩形定义。 饼图部分由 和 sweepAngle 参数定义的startAngle两条径向线以及带椭圆的径向线交集之间的弧线组成。

sweepAngle如果 参数大于 360 度或小于 -360 度,则分别将其视为 360 度或 -360 度。

适用于

FillPie(Brush, RectangleF, Single, Single)

填充由椭圆和两条径向线定义的饼图部分的内部。

public:
 void FillPie(System::Drawing::Brush ^ brush, System::Drawing::RectangleF rect, float startAngle, float sweepAngle);
public void FillPie (System.Drawing.Brush brush, System.Drawing.RectangleF rect, float startAngle, float sweepAngle);
member this.FillPie : System.Drawing.Brush * System.Drawing.RectangleF * single * single -> unit
Public Sub FillPie (brush As Brush, rect As RectangleF, startAngle As Single, sweepAngle As Single)

参数

brush
Brush

确定填充特征的画笔。

rect
RectangleF

定义饼图部分所属的椭圆的边框。

startAngle
Single

从 x 轴沿顺时针方向旋转到扇形区第一个边所测得的角度(以度为单位)。

sweepAngle
Single

startAngle 参数沿顺时针方向旋转到扇形区第二个边所测得的角度(以度为单位)。

适用于

FillPie(Brush, Int32, Int32, Int32, Int32, Int32, Int32)

填充由一对坐标、一个宽度、一个高度以及两条射线指定的椭圆所定义的扇形区的内部。

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

参数

brush
Brush

确定填充特性的 Brush

x
Int32

边框左上角的 x 坐标,该边框定义扇形区所属的椭圆。

y
Int32

边框左上角的 y 坐标,该边框定义扇形区所属的椭圆。

width
Int32

边框的宽度,该边框定义扇形区所属的椭圆。

height
Int32

边框的高度,该边框定义扇形区所属的椭圆。

startAngle
Int32

从 x 轴沿顺时针方向旋转到扇形区第一个边所测得的角度(以度为单位)。

sweepAngle
Int32

startAngle 参数沿顺时针方向旋转到扇形区第二个边所测得的角度(以度为单位)。

例外

brushnull

示例

下面的代码示例旨在与 Windows 窗体 一起使用,它需要 PaintEventArgse,这是事件处理程序的参数Paint。 此代码执行以下操作:

  • 创建纯红色画笔。

  • 创建绑定椭圆的矩形的位置和大小。

  • 定义相对于 x 轴) 的起始角度 (,扫描角度 (顺时针方向) 。

  • 填充屏幕上椭圆的饼形区域。

public:
   void FillPieInt( 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;

      // Create start and sweep angles.
      int startAngle = 0;
      int sweepAngle = 45;
      
      // Fill pie to screen.
      e->Graphics->FillPie( redBrush, x, y, width, height, startAngle, sweepAngle );
   }
public void FillPieInt(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;
             
    // Create start and sweep angles.
    int startAngle =  0;
    int sweepAngle = 45;
             
    // Fill pie to screen.
    e.Graphics.FillPie(redBrush, x, y, width, height, startAngle, sweepAngle);
}
Public Sub FillPieInt(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

    ' Create start and sweep angles.
    Dim startAngle As Integer = 0
    Dim sweepAngle As Integer = 45

    ' Fill pie to screen.
    e.Graphics.FillPie(redBrush, x, y, width, height, startAngle, _
    sweepAngle)
End Sub

注解

此方法填充由椭圆弧定义的饼图部分的内部,以及与弧线端点相交的两条径向线。椭圆由边界矩形定义。 饼图部分由 和 sweepAngle 参数定义的startAngle两条径向线以及带椭圆的径向线交集之间的弧线组成。

sweepAngle如果 参数大于 360 度或小于 -360 度,则分别将其视为 360 度或 -360 度。

适用于

FillPie(Brush, Single, Single, Single, Single, Single, Single)

填充由一对坐标、一个宽度、一个高度以及两条射线指定的椭圆所定义的扇形区的内部。

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

参数

brush
Brush

确定填充特性的 Brush

x
Single

边框左上角的 x 坐标,该边框定义扇形区所属的椭圆。

y
Single

边框左上角的 y 坐标,该边框定义扇形区所属的椭圆。

width
Single

边框的宽度,该边框定义扇形区所属的椭圆。

height
Single

边框的高度,该边框定义扇形区所属的椭圆。

startAngle
Single

从 x 轴沿顺时针方向旋转到扇形区第一个边所测得的角度(以度为单位)。

sweepAngle
Single

startAngle 参数沿顺时针方向旋转到扇形区第二个边所测得的角度(以度为单位)。

例外

brushnull

示例

下面的代码示例旨在与 Windows 窗体 一起使用,它需要 PaintEventArgse,这是事件处理程序的参数Paint。 此代码执行以下操作:

  • 创建纯红色画笔。

  • 创建绑定椭圆的矩形的位置和大小。

  • 定义相对于 x 轴) 的起始角度 (,扫描角度 (顺时针方向) 。

  • 填充屏幕上椭圆的饼形区域。

public:
   void FillPieFloat( 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;

      // Create start and sweep angles.
      float startAngle = 0.0F;
      float sweepAngle = 45.0F;

      // Fill pie to screen.
      e->Graphics->FillPie( redBrush, x, y, width, height, startAngle, sweepAngle );
   }
public void FillPieFloat(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;
             
    // Create start and sweep angles.
    float startAngle =  0.0F;
    float sweepAngle = 45.0F;
             
    // Fill pie to screen.
    e.Graphics.FillPie(redBrush, x, y, width, height, startAngle, sweepAngle);
}
Public Sub FillPieFloat(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

    ' Create start and sweep angles.
    Dim startAngle As Single = 0.0F
    Dim sweepAngle As Single = 45.0F

    ' Fill pie to screen.
    e.Graphics.FillPie(redBrush, x, y, width, height, startAngle, _
    sweepAngle)
End Sub

注解

此方法填充由椭圆弧定义的饼图部分的内部,以及与弧线端点相交的两条径向线。椭圆由边界矩形定义。 饼图部分由 和 sweepAngle 参数定义的startAngle两条径向线以及带椭圆的径向线交集之间的弧线组成。

sweepAngle如果 参数大于 360 度或小于 -360 度,则分别将其视为 360 度或 -360 度。

适用于