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;
                }
            }
        }
    }
    

      

  • 相关阅读:
    sudo命令 sudoers文件
    sscanf函数
    printf格式化输出
    c文件操作
    string和char*
    c去除空格 小写转大写
    主机序和网络序转换
    ulimit用法
    mysql基础(附具体操作代码)
    ES6 class
  • 原文地址:https://www.cnblogs.com/alphafly/p/3815775.html
Copyright © 2011-2022 走看看