Convert the text box value to image

Source: Internet
Author: User

It is very easy to convert the value of a text box into an image. The main. Net class library used is:

System. drawing;


It's easy to read first.CodeRight:


  Protected   Void Btnconvert_click ( Object Sender, eventargs E)
System. Drawing. Bitmap B =   New System. Drawing. Bitmap ( 150 , 80 , System. Drawing. imaging. pixelformat. format32bppargb );
System. Drawing. Graphics g = System. Drawing. Graphics. fromimage (B );

StringA=Txtvalue. Text. tostring ();

G. Clear (system. Drawing. color. Blue );

G. drawstring (, New Font ( " Arial " , 18 , Fontstyle. Bold ), New Solidbrush (color. burlywood ), New Pointf ( 05.0f , 1.50f ));
Response. contenttype = " Image/JPEG " ;
B. Save (response. outputstream, system. Drawing. imaging. imageformat. JPEG );

It is to draw the value in the text box into an image and display OK on the page.




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: 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.