• 把文本框的值转换成Image


    把文本框的值转换成一个Image,很一个很简单的,主要用到的.NET类库是:

    System.Drawing;

    很简单的,先看代码吧:

     protected void btnConvert_Click(object sender, EventArgs e)
        {
            System.Drawing.Bitmap b 
    = new System.Drawing.Bitmap(15080,   System.Drawing.Imaging.PixelFormat.Format32bppArgb);
            System.Drawing.Graphics g 
    = System.Drawing.Graphics.FromImage(b);

            
    string a = txtValue.Text.ToString();

            g.Clear(System.Drawing.Color.Blue);

            g.DrawString(a, 
    new Font("Arial"18, FontStyle.Bold), new SolidBrush(Color.BurlyWood), new PointF(05.0f1.50f));
            Response.ContentType
    ="image/jpeg";
            b.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
        }

    就是把文本框中的值画成一个IMAGE最后在页面上显示OK

    效果:

  • 相关阅读:
    JAVA_File
    JAVA_解决实现接口方法重名问题
    JAVA_Thread_interrupt
    JAVA_Thread_deadlock
    JAVA_Thread_daemon
    JAVA_数组
    JAVA_Runtime
    Castle项目简介第二部分
    Castle项目简介第一部分(译)
    设置VSS使支持通过Internet访问
  • 原文地址:https://www.cnblogs.com/caodaiming/p/1264256.html
Copyright © 2020-2023  润新知