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
Source:
GraphicsPath.cs

Adds the outline of a pie shape to this path.

C#
public void AddPie(System.Drawing.Rectangle rect, float startAngle, float sweepAngle);

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

.NET 10 (package-provided) i druge verzije
Proizvod Verzije
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

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

Source:
GraphicsPath.cs
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.

C#
public void AddPie(int x, int y, int width, int height, float startAngle, float sweepAngle);

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.

C#
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);
}

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

.NET 10 (package-provided) i druge verzije
Proizvod Verzije
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

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

Source:
GraphicsPath.cs
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.

C#
public void AddPie(float x, float y, float width, float height, float startAngle, float sweepAngle);

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

.NET 10 (package-provided) i druge verzije
Proizvod Verzije
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10