Using system;
Using system. collections;
Using system. componentmodel;
Using system. Data;
Using system. drawing;
Using system. Web;
Using system. Web. sessionstate;
Using system. Web. UI;
Using system. Web. UI. webcontrols;
Using system. Web. UI. htmlcontrols;
Using system. Drawing. imaging;
Using system. Drawing. drawing2d;
Using system. IO;
Public partial class admin_drawing_default: system. Web. UI. Page
{
Protected void page_load (Object sender, eventargs E)
{
Response. contenttype = "image/JPEG ";
Const int width = 180, Height = 150;
Int x = 30, y = 50;
Int piewidth = 120, pieheight = 50, pieshadow = 20;
Int [] arrvote = {100, 50,100, 60, 50 };
Random Oran = new random ();
Bitmap objbitmap = new Bitmap (width, height );
Graphics objgraphics = graphics. fromimage (objbitmap );
Objgraphics. drawrectangle (new pen (color. Black), 0, 0, width, height );
Objgraphics. fillrectangle (New solidbrush (color. White), 1, 1, width-2, height-2 );
Solidbrush objbrush = new solidbrush (color. Blue );
Objgraphics. smoothingmode = smoothingmode. antialias;
Int icurrentpos = 0;
Color [] arrcolor = {color. Red, color. Red };
For (INT I = arrvote. Length-1; I> = 0; I --)
{
Arrcolor [I] = color. fromargb (Oran. Next (255), Oran. Next (255), Oran. Next (255 ));
}
for (INT I = arrvote. length-1; I> = 0; I --)
{< br> objbrush. color = arrcolor [I];
for (INT iloop2 = 0; iloop2 objgraphics. fillpie (New hatchbrush (hatchstyle. percent50, objbrush. color), X, Y + iloop2, piewidth, pieheight, icurrentpos, arrvote [I]);
icurrentpos + = arrvote [I];
}
Icurrentpos = 0;
For (INT I = arrvote. Length-1; I> = 0; I --)
{
Objbrush. Color = arrcolor [I];
Objgraphics. fillpie (objbrush, X, Y, piewidth, pieheight, icurrentpos, arrvote [I]);
Icurrentpos + = arrvote [I];
}
Objbitmap. Save (response. outputstream, imageformat. JPEG );
Objgraphics. Dispose ();
Objbitmap. Dispose ();
}
}