c#绘制图表方法

Graphics.FillPie 方法

参数

brush
确定填充特性的 Brush 对象。
x
边框左上角的 x 坐标,该边框定义扇形区所属的椭圆。
y
边框左上角的 y 坐标,该边框定义扇形区所属的椭圆。
width
边框的宽度,该边框定义扇形区所属的椭圆。
height
边框的高度,该边框定义扇形区所属的椭圆。
startAngle
从 x 轴沿顺时针方向旋转到扇形区第一个边所测得的角度(以度为单位)。
sweepAngle
startAngle 参数沿顺时针方向旋转到扇形区第二个边所测得的角度(以度为单位)。
   //开始绘制
   float startAngle=270;
   SolidBrush MyBrush;
   Graphics g=this.pnlPctImg.CreateGraphics();
   g.Clear(this.BackColor);
   MyBrush=new SolidBrush(Color.Red);
   g.FillPie(MyBrush,2,2,120,120,startAngle,(a/100)*360);
   startAngle+=(a/100)*360;
   MyBrush=new SolidBrush(Color.Blue);
   g.FillPie(MyBrush,2,2,120,120,startAngle,(b/100)*360);
   startAngle+=(b/100)*360;
   MyBrush=new SolidBrush(Color.Green);
   g.FillPie(MyBrush,2,2,120,120,startAngle,(c/100)*360);
   startAngle+=(c/100)*360;
   MyBrush=new SolidBrush(Color.Pink);
   g.FillPie(MyBrush,2,2,120,120,startAngle,(d/100)*360);
   g.Dispose();

posted on 2006-10-28 10:13  散步的蠕虫  阅读(1132)  评论(0编辑  收藏  举报

导航