default.aspx.cs

来自「水晶报表详细资料水晶报表详细资料水晶报表详细资料」· CS 代码 · 共 37 行

CS
37
字号
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using System.Drawing;
using System.Drawing.Drawing2D;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Bitmap bitmap = new Bitmap(400, 150);
        Graphics g = Graphics.FromImage(bitmap);
        g.Clear(Color.WhiteSmoke);
        Point[] mypoints = { new Point(50, 20), new Point(120, 20), new Point(350, 80), new Point(50, 100) };
        GraphicsPath mygraphicsPath = new GraphicsPath();
        mygraphicsPath.AddPolygon(mypoints);
        Region myregion = new Region(mygraphicsPath);
        Pen mypen = new Pen(Color.Blue, 2);
        g.DrawPath(mypen, mygraphicsPath);
        g.SetClip(myregion, CombineMode.Replace);
        g.DrawString("明日科技——GDI+区域", new Font(new FontFamily("楷体_GB2312"), 36,
        FontStyle.Regular, GraphicsUnit.Pixel), new SolidBrush(Color.Red), new PointF(40, 50));
        System.IO.MemoryStream ms = new System.IO.MemoryStream();
        bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);
        Response.ClearContent();
        Response.ContentType = "image/Gif";
        Response.BinaryWrite(ms.ToArray());
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?