Graphics.DrawPie 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
绘制由坐标对、宽度、高度和两条径向线指定的椭圆定义的饼图。
重载
DrawPie(Pen, Rectangle, Single, Single) |
绘制由 Rectangle 结构和两条径向线指定的椭圆定义的饼图。 |
DrawPie(Pen, Int32, Int32, Int32, Int32, Int32, Int32) |
绘制由坐标对、宽度、高度和两条径向线指定的椭圆定义的饼图。 |
DrawPie(Pen, Single, Single, Single, Single, Single, Single) |
绘制由坐标对、宽度、高度和两条径向线指定的椭圆定义的饼图。 |
DrawPie(Pen, RectangleF, Single, Single) |
绘制由 RectangleF 结构和两条径向线指定的椭圆定义的饼图。 |
DrawPie(Pen, Rectangle, Single, Single)
- Source:
- Graphics.cs
- Source:
- Graphics.cs
绘制由 Rectangle 结构和两条径向线指定的椭圆定义的饼图。
public:
void DrawPie(System::Drawing::Pen ^ pen, System::Drawing::Rectangle rect, float startAngle, float sweepAngle);
public void DrawPie (System.Drawing.Pen pen, System.Drawing.Rectangle rect, float startAngle, float sweepAngle);
member this.DrawPie : System.Drawing.Pen * System.Drawing.Rectangle * single * single -> unit
Public Sub DrawPie (pen As Pen, rect As Rectangle, startAngle As Single, sweepAngle As Single)
参数
- startAngle
- Single
从 x 轴到饼图的第一侧按度顺时针测量的角度。
- sweepAngle
- Single
从 startAngle
参数到饼图的第二侧按度顺时针测量的角度。
例外
pen
null
。
示例
下面的代码示例设计用于 Windows 窗体,它需要 PaintEventArgse
,这是 Paint 事件处理程序的参数。 该代码执行以下操作:
创建黑色笔。
创建一个矩形,该矩形绑定完整的椭圆。
定义开始绘制(相对于 x 轴)和绘制角度(两者均按顺时针方向)。
将饼图段绘制到屏幕。
public:
void DrawPieRectangle( PaintEventArgs^ e )
{
// Create pen.
Pen^ blackPen = gcnew Pen( Color::Black,3.0f );
// Create rectangle for ellipse.
Rectangle rect = Rectangle(0,0,200,100);
// Create start and sweep angles.
float startAngle = 0.0F;
float sweepAngle = 45.0F;
// Draw pie to screen.
e->Graphics->DrawPie( blackPen, rect, startAngle, sweepAngle );
}
public void DrawPieRectangle(PaintEventArgs e)
{
// Create pen.
Pen blackPen = new Pen(Color.Black, 3);
// 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;
// Draw pie to screen.
e.Graphics.DrawPie(blackPen, rect, startAngle, sweepAngle);
}
Public Sub DrawPieRectangle(ByVal e As PaintEventArgs)
' Create pen.
Dim blackPen As New Pen(Color.Black, 3)
' 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
' Draw pie to screen.
e.Graphics.DrawPie(blackPen, rect, startAngle, sweepAngle)
End Sub
注解
此方法绘制由椭圆弧线和与弧线端点相交的两条径向线定义的饼图。椭圆由边界矩形定义。 饼图由 startAngle
和 sweepAngle
参数定义的两条径向线以及这些径向线与椭圆的交集之间的弧线组成。
如果 sweepAngle
参数大于 360 度或小于 -360 度,则它被视为 360 度或 -360 度。
适用于
DrawPie(Pen, Int32, Int32, Int32, Int32, Int32, Int32)
- Source:
- Graphics.cs
- Source:
- Graphics.cs
绘制由坐标对、宽度、高度和两条径向线指定的椭圆定义的饼图。
public:
void DrawPie(System::Drawing::Pen ^ pen, int x, int y, int width, int height, int startAngle, int sweepAngle);
public void DrawPie (System.Drawing.Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle);
member this.DrawPie : System.Drawing.Pen * int * int * int * int * int * int -> unit
Public Sub DrawPie (pen As Pen, x As Integer, y As Integer, width As Integer, height As Integer, startAngle As Integer, sweepAngle As Integer)
参数
- x
- Int32
边界矩形左上角的 x 坐标,用于定义饼图所在的椭圆。
- y
- Int32
边界矩形左上角的 y 坐标,用于定义饼图所在的椭圆。
- width
- Int32
定义饼图所在的椭圆的边框的宽度。
- height
- Int32
定义饼图所在的椭圆的边框的高度。
- startAngle
- Int32
从 x 轴到饼图的第一侧按度顺时针测量的角度。
- sweepAngle
- Int32
从 startAngle
参数到饼图的第二侧按度顺时针测量的角度。
例外
pen
null
。
示例
下面的代码示例设计用于 Windows 窗体,它需要 PaintEventArgse
,这是 Paint 事件处理程序的参数。 该代码执行以下操作:
创建黑色笔。
创建一个矩形的位置和大小,该矩形绑定完整的椭圆。
定义开始绘制(相对于 x 轴)和绘制角度(两者均按顺时针方向)。
将饼图形状绘制到屏幕。
public:
void DrawPieInt( PaintEventArgs^ e )
{
// Create pen.
Pen^ blackPen = gcnew Pen( Color::Black,3.0f );
// 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;
// Draw pie to screen.
e->Graphics->DrawPie( blackPen, x, y, width, height, startAngle, sweepAngle );
}
public void DrawPieInt(PaintEventArgs e)
{
// Create pen.
Pen blackPen = new Pen(Color.Black, 3);
// 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;
// Draw pie to screen.
e.Graphics.DrawPie(blackPen, x, y, width, height, startAngle, sweepAngle);
}
Public Sub DrawPieInt(ByVal e As PaintEventArgs)
' Create pen.
Dim blackPen As New Pen(Color.Black, 3)
' 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
' Draw pie to screen.
e.Graphics.DrawPie(blackPen, x, y, width, height, _
startAngle, sweepAngle)
End Sub
注解
此方法绘制由椭圆弧线和与弧线端点相交的两条径向线定义的饼图。椭圆由 x
、y
、width
和 height
参数描述的边界矩形定义。 饼图由 startAngle
和 sweepAngle
参数定义的两条径向线以及这些径向线与椭圆的交集之间的弧线组成。
如果 sweepAngle
参数大于 360 度或小于 -360 度,则它被视为 360 度或 -360 度。
适用于
DrawPie(Pen, Single, Single, Single, Single, Single, Single)
- Source:
- Graphics.cs
- Source:
- Graphics.cs
绘制由坐标对、宽度、高度和两条径向线指定的椭圆定义的饼图。
public:
void DrawPie(System::Drawing::Pen ^ pen, float x, float y, float width, float height, float startAngle, float sweepAngle);
public void DrawPie (System.Drawing.Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle);
member this.DrawPie : System.Drawing.Pen * single * single * single * single * single * single -> unit
Public Sub DrawPie (pen As Pen, x As Single, y As Single, width As Single, height As Single, startAngle As Single, sweepAngle As Single)
参数
- x
- Single
边界矩形左上角的 x 坐标,用于定义饼图所在的椭圆。
- y
- Single
边界矩形左上角的 y 坐标,用于定义饼图所在的椭圆。
- width
- Single
定义饼图所在的椭圆的边框的宽度。
- height
- Single
定义饼图所在的椭圆的边框的高度。
- startAngle
- Single
从 x 轴到饼图的第一侧按度顺时针测量的角度。
- sweepAngle
- Single
从 startAngle
参数到饼图的第二侧按度顺时针测量的角度。
例外
pen
null
。
示例
下面的代码示例设计用于 Windows 窗体,它需要 PaintEventArgse
,这是 Paint 事件处理程序的参数。 该代码执行以下操作:
创建黑色笔。
创建一个矩形的位置和大小,该矩形绑定完整的椭圆。
定义开始绘制(相对于 x 轴)和绘制角度(两者均按顺时针方向)。
将饼图段绘制到屏幕。
public:
void DrawPieFloat( PaintEventArgs^ e )
{
// Create pen.
Pen^ blackPen = gcnew Pen( Color::Black,3.0f );
// 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;
// Draw pie to screen.
e->Graphics->DrawPie( blackPen, x, y, width, height, startAngle, sweepAngle );
}
public void DrawPieFloat(PaintEventArgs e)
{
// Create pen.
Pen blackPen = new Pen(Color.Black, 3);
// 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;
// Draw pie to screen.
e.Graphics.DrawPie(blackPen, x, y, width, height, startAngle, sweepAngle);
}
Public Sub DrawPieFloat(ByVal e As PaintEventArgs)
' Create pen.
Dim blackPen As New Pen(Color.Black, 3)
' 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
' Draw pie to screen.
e.Graphics.DrawPie(blackPen, x, y, width, height, _
startAngle, sweepAngle)
End Sub
注解
此方法绘制由椭圆弧线和与弧线端点相交的两条径向线定义的饼图。椭圆由 x
、y
、width
和 height
参数描述的边界矩形定义。 饼图由 startAngle
和 sweepAngle
参数定义的两条径向线以及这些径向线与椭圆的交集之间的弧线组成。
如果 sweepAngle
参数大于 360 度或小于 -360 度,则它被视为 360 度或 -360 度。
适用于
DrawPie(Pen, RectangleF, Single, Single)
- Source:
- Graphics.cs
- Source:
- Graphics.cs
绘制由 RectangleF 结构和两条径向线指定的椭圆定义的饼图。
public:
void DrawPie(System::Drawing::Pen ^ pen, System::Drawing::RectangleF rect, float startAngle, float sweepAngle);
public void DrawPie (System.Drawing.Pen pen, System.Drawing.RectangleF rect, float startAngle, float sweepAngle);
member this.DrawPie : System.Drawing.Pen * System.Drawing.RectangleF * single * single -> unit
Public Sub DrawPie (pen As Pen, rect As RectangleF, startAngle As Single, sweepAngle As Single)
参数
- rect
- RectangleF
RectangleF 结构,该结构表示定义饼形所在的椭圆的边界矩形。
- startAngle
- Single
从 x 轴到饼图的第一侧按度顺时针测量的角度。
- sweepAngle
- Single
从 startAngle
参数到饼图的第二侧按度顺时针测量的角度。
例外
pen
null
。
示例
下面的代码示例设计用于 Windows 窗体,它需要 PaintEventArgse
,这是 Paint 事件处理程序的参数。 该代码执行以下操作:
创建黑色笔。
创建一个矩形,该矩形绑定完整的椭圆。
定义开始绘制(相对于 x 轴)和绘制角度(两者均按顺时针方向)。
将饼图段绘制到屏幕。
public:
void DrawPieRectangleF( PaintEventArgs^ e )
{
// Create pen.
Pen^ blackPen = gcnew Pen( Color::Black,3.0f );
// Create rectangle for ellipse.
RectangleF rect = RectangleF(0.0F,0.0F,200.0F,100.0F);
// Create start and sweep angles.
float startAngle = 0.0F;
float sweepAngle = 45.0F;
// Draw pie to screen.
e->Graphics->DrawPie( blackPen, rect, startAngle, sweepAngle );
}
public void DrawPieRectangleF(PaintEventArgs e)
{
// Create pen.
Pen blackPen = new Pen(Color.Black, 3);
// Create rectangle for ellipse.
RectangleF rect = new RectangleF(0.0F, 0.0F, 200.0F, 100.0F);
// Create start and sweep angles.
float startAngle = 0.0F;
float sweepAngle = 45.0F;
// Draw pie to screen.
e.Graphics.DrawPie(blackPen, rect, startAngle, sweepAngle);
}
Public Sub DrawPieRectangleF(ByVal e As PaintEventArgs)
' Create pen.
Dim blackPen As New Pen(Color.Black, 3)
' Create rectangle for ellipse.
Dim rect As New RectangleF(0.0F, 0.0F, 200.0F, 100.0F)
' Create start and sweep angles.
Dim startAngle As Single = 0.0F
Dim sweepAngle As Single = 45.0F
' Draw pie to screen.
e.Graphics.DrawPie(blackPen, rect, startAngle, sweepAngle)
End Sub
注解
此方法绘制由椭圆弧线和与弧线端点相交的两条径向线定义的饼图。椭圆由边界矩形定义。 饼图由 startAngle
和 sweepAngle
参数定义的两条径向线以及这些径向线与椭圆的交集之间的弧线组成。
如果 sweepAngle
参数大于 360 度或小于 -360 度,则它被视为 360 度或 -360 度。