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)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

填充由 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 参数到饼图部分第二侧的顺时针度量角度。

例外

brush null

示例

下面的代码示例设计用于 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

注解

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

如果 sweepAngle 参数大于 360 度或小于 -360 度,则它被视为 360 度或 -360 度。

适用于

FillPie(Brush, RectangleF, Single, Single)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

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

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)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

填充由一对坐标、宽度、高度和两条径向线指定的椭圆定义的饼图部分的内部。

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 参数到饼图部分第二侧的顺时针度量角度。

例外

brush null

示例

下面的代码示例设计用于 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

注解

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

如果 sweepAngle 参数大于 360 度或小于 -360 度,则它被视为 360 度或 -360 度。

适用于

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

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

填充由一对坐标、宽度、高度和两条径向线指定的椭圆定义的饼图部分的内部。

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 参数到饼图部分第二侧的顺时针度量角度。

例外

brush null

示例

下面的代码示例设计用于 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

注解

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

如果 sweepAngle 参数大于 360 度或小于 -360 度,则它被视为 360 度或 -360 度。

适用于