Composite of GDI +

xiaoxiao2021-03-06  62

GDI service is divided into the following three categories:

Two-dimensional vector graphics

Image Processing

format

When GDI is dealt, it is actually built, and then draws a graphic frame on the canvas, followed by filling something in the frame, and finally the release of the resource is an example of a pie chart. Using system; use system.collections; ComponentModel; using System.Data; using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web. Ui.WebControls; use system.web.ui.htmlcontrols;

A summary description of Namespace gditest {///

/// TOPN3DPIE. /// public class GDITest: System.Web.UI.Page {private void Page_Load (object sender, System.EventArgs e) {Response.ContentType = "image / gif"; 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-100, height-100); Graphics objGraphics = Graphics.FromImage (objBitmap); objGraphics.DrawRectangle (new Pen (Color.Black), 0,0, width-100, height-100); 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, 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 () {this.load = new system.eventhandler (this.page_load);

} #Endregion}}}

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

New Post(0)