Graphics.FillPie 方法

Graphics.FillPie 方法 (Brush, Int32, Int32, Int32, Int32, Int32, Int32)

填充由一对坐标、一个宽度、一个高度以及两条射线指定的椭圆所定义的扇形区的内部。

[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 参数沿顺时针方向旋转到扇形区第二个边所测得的角度(以度为单位)。
返回值

此方法不返回值。

备注

此方法填充由椭圆的一段弧线和与该弧线端点相交的两条射线定义的扇形区的内部。该椭圆由边框定义。扇形区由 startAnglesweepAngle 参数定义的两条射线以及这两条射线与椭圆交点之间的弧线组成。

如果 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 系列 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值