圖形顯示函數
前段時(shí)間寫的一個(gè)圖形比例顯示的函數(shù),代碼很簡單!
????????private?void?DrawGraphic(double?UnReadyNum,double?ReadyNum,double?FinishNum)
????????{
????????????double?iPercentAngle;
????????????iPercentAngle?=?360?/?(UnReadyNum?+?ReadyNum?+?FinishNum);
????????????//生成一個(gè)Bitmap
????????????Bitmap?objBitmap;
????????????objBitmap?=?new?Bitmap(450,400,PixelFormat.Format64bppPArgb);
????????????//生成一個(gè)Graphics,同時(shí)清除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);
????????}
????????private?void?DrawGraphic(double?UnReadyNum,double?ReadyNum,double?FinishNum)
????????{
????????????double?iPercentAngle;
????????????iPercentAngle?=?360?/?(UnReadyNum?+?ReadyNum?+?FinishNum);
????????????//生成一個(gè)Bitmap
????????????Bitmap?objBitmap;
????????????objBitmap?=?new?Bitmap(450,400,PixelFormat.Format64bppPArgb);
????????????//生成一個(gè)Graphics,同時(shí)清除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);
????????}
轉(zhuǎn)載于:https://www.cnblogs.com/dotnetbbs/archive/2006/05/08/393636.html
總結(jié)
- 上一篇: C# .Net中的类型转换
- 下一篇: 如何获取空对象的类型