vpic.aspx.cs
(完整代码) 1KBusing System;
using System.Data;
using System.Configuration;
using System.Collections;
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;
public partial class vpic : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
#region 生成验证码
if (Session.Contents["vpic"] == null)
Session.Add("vpic", null);
Random rand = new Random();
string vaildate = rand.Next(100, 1000).ToString();
Session.Contents["vpic"] = vaildate;
System.Drawing.Image image = new System.Drawing.Bitmap(30, 16);
System.Drawing.Graphics formGraphice = System.Drawing.Graphics.FromImage(image);
System.Drawing.Font font = new System.Drawing.Font("Arial", 10, FontStyle.Regular);
System.Drawing.SolidBrush brush = new System.Drawing.SolidBrush(System.Drawing.Color.Black);
formGraphice.Clear(System.Drawing.Color.White);
System.Drawing.StringFormat format = new System.Drawing.StringFormat();
int x1, x2, y1, y2;
Random random = new Random();
//画图片的背景噪音线
x1 = random.Next(image.Width);
x2 = random.Next(image.Width);
y1 = random.Next(image.Height);
y2 = random.Next(image.Height);
formGraphice.DrawLine(new Pen(Color.Black), x1, y1, x2, y2);
x1 = random.Next(image.Width);
x2 = random.Next(image.Width);
y1 = random.Next(image.Height);
y2 = random.Next(image.Height);
formGraphice.DrawLine(new Pen(Color.Gray), x1, y1, x2, y2);
formGraphice.DrawString(vaildate, font, brush, 0, 00, format);
font.Dispose();
brush.Dispose();
formGraphice.Dispose();
image.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
#endregion
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
