handler.ashx
来自「Asp.net物资流通管理系统源码 本系统主要针对物流供应链中的库存管理环」· ASHX 代码 · 共 36 行
ASHX
36 行
<%@ WebHandler Language="C#" Class="Handler" %>
using System;
using System.Web;
using System.Drawing;
using System.Drawing.Imaging;
using System.Web.SessionState;
public class Handler : IHttpHandler,IRequiresSessionState {
public void ProcessRequest (HttpContext context) {
//context.Response.ContentType = "text/plain";
//context.Response.Write("Hello World");
Bitmap NewBmp = new Bitmap(36,16,PixelFormat.Format32bppArgb);
Graphics g = Graphics.FromImage(NewBmp);
g.FillRectangle(new SolidBrush(Color.White),new Rectangle(0,0,36,20));
Font textFont = new Font("GB2312", 10);
Rectangle rectangle = new Rectangle(0,0,36,20);
string ThisNum = Convert.ToString(GetNum());
context.Session["CheckNum"] = ThisNum;
g.FillRectangle(new SolidBrush(Color.BurlyWood),rectangle);
g.DrawString(ThisNum,textFont,new SolidBrush(Color.Blue),rectangle);
NewBmp.Save(context.Response.OutputStream,ImageFormat.Jpeg);
}
public bool IsReusable {
get {
return false;
}
}
public int GetNum() {
int GiveNum;
Random MyNum = new Random();
GiveNum = MyNum.Next(8999) + 1000;
return GiveNum;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?