ASP.NET uses GDI + draw 3D pie chart entry source code

xiaoxiao2021-03-06  57

TOPN3DPIE.ASPX ------------------- <% @ page language = "c #" codebehind = "TOPN3DPIE.ASPX.CS" autoeventwireup = "false" inherits = "Yeefly.topn3dpie "%> Topn3dpie.aspx.cs ---------------------- Using System; Using System.Collections; Using System.ComponentModel; Using System.Data; Using System.drawing; Using System.drawing; .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;

Namespace Yeefly {///

/// graph's summary description. /// public class topn3dpie: System.Web.UI.Page {private void Page_Load (object sender, System.EventArgs e) {Response.ContentType = "image / jpeg"; const int width = 300, height = 300; int x = 30, y = 50;

INT Piewidth = 120, Pieheight = 40, pieshadow = 15; int [] arrvote = {70, 90, 80, 20, 60, 40}; 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 icrrentpos = 0;

Color [] Arrcolor = {Color.red, Color.red, Color.Red, Color.Red, Color.Red, Color.red};

For (int i = arrvote.length - 1; i> = 0; I -) {Arrcolor [i] = color.fromargb (ORAN.NEXT (255), ORAN.NEXT (255) }

For (int i = arrvote.length - 1; i> = 0; I -) {objbrush.color = arrcolor [i]; for (int iLoop2 = 0; iLoop2 = 0; I -) {Objbrush.color = arrcolor [i]; Objgraphics.Fillpie (Objbrush, X, Y, Piewidth, Pieheight, IcurrentPos, Arrvote [i]); icRentPos = Arrvote [i]; }

Objbitmap.save (response.outputstream, imageformat.jpeg); // clean Up ... Objgraphics.dispose (); objbitmap.dispose ();

#Region Web Form Designer Generated Code Override Protected Void OnNit (Eventargs E) {// // Codegen: This call is required for the ASP.NET Web Form Designer. // InitializeComponent (); base.onit (e);} ///

/// Designer Supports the required method - Do not use the code editor to modify the // / this method. /// private vid initializecomponent () {this.load = new system.eventhandler (this.page_load);} #ENDREGON}} ----------------- -----------------

转载请注明原文地址:https://www.9cbs.com/read-113453.html

New Post(0)