ASP. NET-Dynamic Graph Creation

Source: Internet
Author: User

The graph creation function of VS is really powerful!

Code
System. Drawing. Image IMG = system. Drawing. image. fromfile ("model.jpg ");
Graphics G = system. Drawing. Graphics. fromimage (IMG );
// Create Image Quality to eliminate sawtooth data
G. smoothingmode = smoothingmode. antialias;
G. textrenderinghint = system. Drawing. Text. textrenderinghint. antialiasgridfit;

// Draw something what you want
G. drawstring ("title", new font ("", 22, fontstyle. Bold), new solidbrush (color. fromargb (188,254, 6), 5, 15 );
G. drawstring (8.8), new font ("Times New Roman", 50, fontstyle. Bold), new solidbrush (color. Black), 55,145 );
G. drawstring ("online shop address:", new font ("", 13, fontstyle. Regular), new solidbrush (color. White), 5,305 );
G. drawstring ("validity period: To", new font ("", 13, fontstyle. Regular), new solidbrush (color. White), 285,305 );

G. Dispose ();

// Modify the Image Storage Quality
Encoder myencoder = encoder. quality;
Encoderparameters myencoderparameters = new encoderparameters (1 );
// Image Quality Grade
Encoderparameter myencoderparameter = new encoderparameter (myencoder, 100l );
Myencoderparameters. Param [0] = myencoderparameter;
// File type
Imagecodecinfo [] imagecodecinfo = imagecodecinfo. getimageencoders ();

// Save
IMG. Save (server. mappath (filename), imagecodecinfo [1], myencoderparameters );
Myencoderparameter. Dispose ();
Myencoderparameters. Dispose ();

 

Effect:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.