Bewerken

Share via


GraphicsPath.AddPie Method

Definition

Adds the outline of a pie shape to this path.

Overloads

AddPie(Rectangle, Single, Single)

Adds the outline of a pie shape to this path.

AddPie(Int32, Int32, Int32, Int32, Single, Single)

Adds the outline of a pie shape to this path.

AddPie(Single, Single, Single, Single, Single, Single)

Adds the outline of a pie shape to this path.

AddPie(Rectangle, Single, Single)

Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs

Adds the outline of a pie shape to this path.

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

Parameters

rect
Rectangle

A Rectangle that represents the bounding rectangle that defines the ellipse from which the pie is drawn.

startAngle
Single

The starting angle for the pie section, measured in degrees clockwise from the x-axis.

sweepAngle
Single

The angle between startAngle and the end of the pie section, measured in degrees clockwise from startAngle.

Examples

For an example, see AddPie(Int32, Int32, Int32, Int32, Single, Single).

Remarks

The pie shape is defined by a partial outline of an ellipse and the two radial lines that intersect the endpoints of the partial outline. The partial outline begins at startAngle (measured clockwise from the x-axis) and ends at startAngle + sweepAngle.

Applies to

AddPie(Int32, Int32, Int32, Int32, Single, Single)

Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs

Adds the outline of a pie shape to this path.

public:
 void AddPie(int x, int y, int width, int height, float startAngle, float sweepAngle);
public void AddPie (int x, int y, int width, int height, float startAngle, float sweepAngle);
member this.AddPie : int * int * int * int * single * single -> unit
Public Sub AddPie (x As Integer, y As Integer, width As Integer, height As Integer, startAngle As Single, sweepAngle As Single)

Parameters

x
Int32

The x-coordinate of the upper-left corner of the bounding rectangle that defines the ellipse from which the pie is drawn.

y
Int32

The y-coordinate of the upper-left corner of the bounding rectangle that defines the ellipse from which the pie is drawn.

width
Int32

The width of the bounding rectangle that defines the ellipse from which the pie is drawn.

height
Int32

The height of the bounding rectangle that defines the ellipse from which the pie is drawn.

startAngle
Single

The starting angle for the pie section, measured in degrees clockwise from the x-axis.

sweepAngle
Single

The angle between startAngle and the end of the pie section, measured in degrees clockwise from startAngle.

Examples

The following code example is designed for use with Windows Forms, and it requires PaintEventArgs e, an OnPaint event object. The code creates a graphics path, adds the pie shape, and then draws the path to the screen.

private:
   void AddPieExample( PaintEventArgs^ e )
   {
      // Create a pie slice of a circle using the AddPie method.
      GraphicsPath^ myPath = gcnew GraphicsPath;
      myPath->AddPie( 20, 20, 70, 70, -45, 90 );

      // Draw the path to the screen.
      Pen^ myPen = gcnew Pen( Color::Black,2.0f );
      e->Graphics->DrawPath( myPen, myPath );
   }
private void AddPieExample(PaintEventArgs e)
{
             
    // Create a pie slice of a circle using the AddPie method.
    GraphicsPath myPath = new GraphicsPath();
    myPath.AddPie(20, 20, 70, 70, -45, 90);
             
    // Draw the path to the screen.
    Pen myPen = new Pen(Color.Black, 2);
    e.Graphics.DrawPath(myPen, myPath);
}
Public Sub AddPieExample(ByVal e As PaintEventArgs)

    ' Create a pie slice of a circle using the AddPie method.
    Dim myPath As New GraphicsPath
    myPath.AddPie(20, 20, 70, 70, -45, 90)

    ' Draw the path to the screen.
    Dim myPen As New Pen(Color.Black, 2)
    e.Graphics.DrawPath(myPen, myPath)
End Sub

Remarks

The pie shape is defined by a partial outline of an ellipse and the two radial lines that intersect the endpoints of the partial outline. The partial outline begins at startAngle (measured clockwise from the x-axis) and ends at startAngle + sweepAngle.

Applies to

AddPie(Single, Single, Single, Single, Single, Single)

Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs

Adds the outline of a pie shape to this path.

public:
 void AddPie(float x, float y, float width, float height, float startAngle, float sweepAngle);
public void AddPie (float x, float y, float width, float height, float startAngle, float sweepAngle);
member this.AddPie : single * single * single * single * single * single -> unit
Public Sub AddPie (x As Single, y As Single, width As Single, height As Single, startAngle As Single, sweepAngle As Single)

Parameters

x
Single

The x-coordinate of the upper-left corner of the bounding rectangle that defines the ellipse from which the pie is drawn.

y
Single

The y-coordinate of the upper-left corner of the bounding rectangle that defines the ellipse from which the pie is drawn.

width
Single

The width of the bounding rectangle that defines the ellipse from which the pie is drawn.

height
Single

The height of the bounding rectangle that defines the ellipse from which the pie is drawn.

startAngle
Single

The starting angle for the pie section, measured in degrees clockwise from the x-axis.

sweepAngle
Single

The angle between startAngle and the end of the pie section, measured in degrees clockwise from startAngle.

Examples

For an example, see AddPie(Int32, Int32, Int32, Int32, Single, Single).

Remarks

The pie shape is defined by a partial outline of an ellipse and the two radial lines that intersect the endpoints of the partial outline. The partial outline begins at startAngle (measured clockwise from the x-axis) and ends at startAngle + sweepAngle.

Applies to