⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 handler.ashx

📁 Asp.net物资流通管理系统源码 本系统主要针对物流供应链中的库存管理环节
💻 ASHX
字号:
<%@ 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -