大众计算机学习网

专门提供各种电脑教程

asp.net图形显示函数

Admin | 2007-12-23 12:11:21 | 被阅次数 | 4585

 private void DrawGraphic(double UnReadyNum,double ReadyNum,double FinishNum)
          {
             double iPercentAngle;
 
             iPercentAngle = 360 / (UnReadyNum + ReadyNum + FinishNum);
 
             //生成一個Bitmap
             Bitmap objBitmap;
             objBitmap = new Bitmap(450,400,PixelFormat.Format64bppPArgb);
 
 
             //生成一個Graphics,同時清除Bitmap的背景色為White.
             Graphics objGraphics;
             objGraphics = Graphics.FromImage(objBitmap);
             objGraphics.Clear(Color.White);
 
             //畫圖
             objGraphics.FillEllipse(Brushes.Red,120,10,200,200);
             objGraphics.FillPie(Brushes.Orange,120,10,200,200,0,(float)(ReadyNum*iPercentAngle));
             objGraphics.FillPie(Brushes.Green,120,10,200,200,(float)(ReadyNum*iPercentAngle),(float)(FinishNum*iPercentAngle));
 
             objBitmap.Save(Response.OutputStream,ImageFormat.Gif);
         }