Response.Clear();
Response.ContentType = "image/jpeg";
int width = 50;
int height = 25;
Bitmap bmp = new Bitmap(width, height, PixelFormat.Format24bppRgb);
Graphics g = Graphics.FromImage(bmp);
HatchBrush b = new HatchBrush(HatchStyle.Cross, Color.LightGray, Color.WhiteSmoke);
g.FillRectangle(b, 0, 0, width, height);
Random r = new Random(Convert.ToInt32(DateTime.Now.Millisecond));
string Code = r.Next(1000, 9999).ToString();
Session["ValidateCode"] = Code;
g.DrawString(Code, new Font("Arial", 10, FontStyle.Bold), SystemBrushes.WindowText, 10.0F, 5.0F);
bmp.Save(Response.OutputStream, ImageFormat.Jpeg);
b.Dispose();
g.Dispose();
bmp.Dispose();
Response.End();
相关文章:
-
2021-09-20
-
2022-12-23
-
2021-09-07
-
2022-02-09
-
2021-12-12
-
2021-12-13
-
2022-01-06
-
2021-04-26
猜你喜欢
-
2022-12-23
-
2021-05-03
-
2021-11-01
-
2022-01-02
-
2021-10-03
-
2022-12-23
相关资源
-
下载
2022-12-17
-
下载
2023-01-21
-
下载
2022-12-16