码迷,mamicode.com
首页 > 其他好文 > 详细

C#画图

时间:2014-07-01 00:20:26      阅读:219      评论:0      收藏:0      [点我收藏+]

标签:blog   http   width   cti   for   io   

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

  

C#画图,布布扣,bubuko.com

C#画图

标签:blog   http   width   cti   for   io   

原文地址:http://www.cnblogs.com/alphafly/p/3815775.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!