填充由一对坐标、一个宽度、一个高度以及两条射线指定的椭圆所定义的扇形区的内部。
[Visual Basic] Overloads Public Sub FillPie( _ ByVal brush As Brush, _ ByVal x As Integer, _ ByVal y As Integer, _ ByVal width As Integer, _ ByVal height As Integer, _ ByVal startAngle As Integer, _ ByVal sweepAngle As Integer _ ) [C#] public void FillPie( Brush brush, int x, int y, int width, int height, int startAngle, int sweepAngle ); [C++] public: void FillPie( Brush* brush, int x, int y, int width, int height, int startAngle, int sweepAngle ); [JScript] public function FillPie( brush : Brush, x : int, y : int, width : int, height : int, startAngle : int, sweepAngle : int );
参数
-
brush
- 确定填充特性的 Brush 对象。 x
- 边框左上角的 x 坐标,该边框定义扇形区所属的椭圆。 y
- 边框左上角的 y 坐标,该边框定义扇形区所属的椭圆。 width
- 边框的宽度,该边框定义扇形区所属的椭圆。 height
- 边框的高度,该边框定义扇形区所属的椭圆。 startAngle
- 从 x 轴沿顺时针方向旋转到扇形区第一个边所测得的角度(以度为单位)。 sweepAngle
- 从 startAngle 参数沿顺时针方向旋转到扇形区第二个边所测得的角度(以度为单位)。
返回值
此方法不返回值。
备注
此方法填充由椭圆的一段弧线和与该弧线端点相交的两条射线定义的扇形区的内部。该椭圆由边框定义。扇形区由 startAngle 和 sweepAngle 参数定义的两条射线以及这两条射线与椭圆交点之间的弧线组成。
如果 sweepAngle 参数大于 360 度或小于 -360 度,则将其分别视为 360 度或 -360 度。
示例
[Visual Basic, C#] 下面的示例旨在用于 Windows 窗体,它需要 PaintEventArgs e(这是 Paint 事件处理程序的参数)。代码执行下列操作:
- 创建一支纯红色画笔。
- 创建限定椭圆的矩形的位置和大小。
- 定义起始角度(相对于 x 轴)和扫描角度(两者都沿顺时针方向)。
- 填充屏幕上椭圆的扇形区域。
[Visual Basic] Public Sub FillPieInt(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 [C#] 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); }
[C++, JScript] 没有可用于 C++ 或 JScript 的示例。若要查看 Visual Basic 或 C# 示例,请单击页左上角的“语言筛选器”按钮 。
要求
平台: Windows 98, Windows NT 4.0, Windows ME, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 系列