zoukankan      html  css  js  c++  java
  • C#画图

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Drawing;
    
    namespace BitMap
    {
        /// <summary>
        /// Image 的摘要说明
        /// </summary>
        public class Image : IHttpHandler
        {
    
            public void ProcessRequest(HttpContext context)
            {
                context.Response.ContentType = "text/jpeg";
    
                //画板
                using (Bitmap bitMap = new Bitmap(100, 100))
                {
                    //画笔
                    using (Graphics g = Graphics.FromImage(bitMap))
                    {
                        //填充北京颜色
                        g.FillRectangle(Brushes.Cornsilk, 0, 0, bitMap.Width, bitMap.Height);
                        g.DrawString("Cupid", new Font("微软雅黑", 20), Brushes.Blue, new Point(10, 5));
                        bitMap.Save(context.Response.OutputStream,System.Drawing.Imaging.ImageFormat.Jpeg);
                    }
                }
            }
    
            public bool IsReusable
            {
                get
                {
                    return false;
                }
            }
        }
    }
    

      

  • 相关阅读:
    5
    4
    2
    3
    1
    IOS js交互
    vm安装mac
    索引
    ORM 基础
    reids 日志no
  • 原文地址:https://www.cnblogs.com/alphafly/p/3815775.html
Copyright © 2011-2022 走看看