怎么样画填充圆
画一个圆,这个圆由不同颜色组成
如红允占30%,绿色占35%,黄色占20%,黑色占15%
这颜色比例是变量,会变化的
请问这样的圆怎么画?
------解决方案--------------------参考:
http://www.cnblogs.com/KenBlove/archive/2006/11/23/462576.html
其实就是饼图
------解决方案--------------------lz不就是要画饼图吗?网上例子多得是
------解决方案--------------------//自己写了一个,供参考
private void DrawPies(Graphics AGraphics, Rectangle ARect, params PieInfo[] APies)
{
if (AGraphics == null) return;
uint vSum = 0;
foreach (PieInfo vPieInfo in APies)
vSum += vPieInfo.Number;
double vAngle = 0;
foreach (PieInfo vPieInfo in APies)
{
if (vPieInfo.Number == 0) continue;
double vAngleOffset = ((double)vPieInfo.Number / vSum) * 360;
AGraphics.FillPie(new SolidBrush(vPieInfo.Color),
ARect, (float)vAngle, (float)vAngleOffset);
vAngle += vAngleOffset;
}
}
private void button1_Click(object sender, EventArgs e)
{
//如红允占30%,绿色占35%,黄色占20%,黑色占15%
Graphics vGraphics = CreateGraphics();
DrawPies(vGraphics, new Rectangle(0, 0, 200, 200),
new PieInfo(Color.Red, 30),
new PieInfo(Color.Green, 35),
new PieInfo(Color.Yellow, 20),
new PieInfo(Color.Black, 15));
vGraphics.Dispose();
}
------解决方案--------------------以上几位老大说的够快的