填充由一对坐标、一个宽度、一个高度以及两条射线指定的椭圆所定义的扇形区的内部。[Visual Basic] Overloads Public Sub FillPie(Brush, Integer, Integer, Integer, Integer, Integer, Integer)
[C#] public void FillPie(Brush, int, int, int, int, int, int);
[C#] public void FillPie(Brush, int, int, int, int, int, int);
public void FillPie(
Brush brush,
int x,
int y,
int width,
int height,
int startAngle,
int sweepAngle
);
参数
brush
确定填充特性的 Brush 对象。
x
边框左上角的 x 坐标,该边框定义扇形区所属的椭圆。
y
边框左上角的 y 坐标,该边框定义扇形区所属的椭圆。
width
边框的宽度,该边框定义扇形区所属的椭圆。
height
边框的高度,该边框定义扇形区所属的椭圆。
startAngle
从 x 轴沿顺时针方向旋转到扇形区第一个边所测得的角度(以度为单位)。
sweepAngle
从 startAngle 参数沿顺时针方向旋转到扇形区第二个边所测得的角度(以度为单位)。
返回值
此方法不返回值。备注
Timer temer = new Timer();
int i = 0;
SolidBrush redBrush = new SolidBrush(Color.Red);
private void button5_Click(object sender, System.EventArgs e)
{
this.temer.Interval = 10;
this.temer.Tick += new System.EventHandler(this.timer_Tick);
this.temer.Start();
}
private void timer_Tick(object sender, System.EventArgs e)
{
// Create location and size of ellipse.
float x = 20.0F;
float y = 20.0F;
float width = 200.0F;
float height = 200.0F;
// Create start and sweep angles.
float startAngle = 0.0F;
float sweepAngle = ++i;
// Fill pie to screen.
Graphics g = this.CreateGraphics();
g.FillPie(redBrush, x, y, width, height, startAngle, sweepAngle);
if(i == 360)
{
i = 0;
this.Refresh();
}
}
可用以下两句代替
SolidBrush tempBrush = new SolidBrush(this.BackColor);
g.FillPie(tempBrush, x, y, width, height, startAngle, sweepAngle);
但是会有虚圆出现