This documentation is archived and is not being maintained.

Graphics.FillPie Method

Fills the interior of a pie section defined by an ellipse specified by a pair of coordinates, a width, and a height and two radial lines.

Overload List

Fills the interior of a pie section defined by an ellipse specified by a RectangleF structure and two radial lines.

[Visual Basic] Overloads Public Sub FillPie(Brush, Rectangle, Single, Single)
[C#] public void FillPie(Brush, Rectangle, float, float);
[C++] public: void FillPie(Brush*, Rectangle, float, float);
[JScript] public function FillPie(Brush, Rectangle, float, float);

Fills the interior of a pie section defined by an ellipse specified by a pair of coordinates, a width, and a height and two radial lines.

[Visual Basic] Overloads Public Sub FillPie(Brush, Integer, Integer, Integer, Integer, Integer, Integer)
[C#] public void FillPie(Brush, int, int, int, int, int, int);
[C++] public: void FillPie(Brush*, int, int, int, int, int, int);
[JScript] public function FillPie(Brush, int, int, int, int, int, int);

Fills the interior of a pie section defined by an ellipse specified by a pair of coordinates, a width, and a height and two radial lines.

[Visual Basic] Overloads Public Sub FillPie(Brush, Single, Single, Single, Single, Single, Single)
[C#] public void FillPie(Brush, float, float, float, float, float, float);
[C++] public: void FillPie(Brush*, float, float, float, float, float, float);
[JScript] public function FillPie(Brush, float, float, float, float, float, float);

Example

[Visual Basic, C#] The following example is designed for use with Windows Forms, and it requires PaintEventArgs e, which is a parameter of the Paint event handler. The code performs the following actions:

  • Creates a solid red brush.
  • Creates the location and size of a rectangle that bounds an ellipse.
  • Defines the start angle (relative to the x axis) and the sweep angle (both in a clockwise direction).
  • Fills the pie-shaped area of the ellipse on the screen.
[Visual Basic, C#] Note   This example shows how to use one of the overloaded versions of FillPie. For other examples that might be available, see the individual overload topics.
[Visual Basic] 
Public Sub FillPieFloat(e As PaintEventArgs)
' Create solid brush.
Dim redBrush As New SolidBrush(Color.Red)
' Create location and size of ellipse.
Dim x As Single = 0F
Dim y As Single = 0F
Dim width As Single = 200F
Dim height As Single = 100F
' Create start and sweep angles.
Dim startAngle As Single = 0F
Dim sweepAngle As Single = 45F
' Fill pie to screen.
e.Graphics.FillPie(redBrush, x, y, width, height, startAngle, _
sweepAngle)
End Sub
        
[C#] 
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);
}
        

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

Graphics Class | Graphics Members | System.Drawing Namespace

Show: