一个生成Validatecode 的代码。Response.Clear();
一个生成Validatecode 的代码。            Response.ContentType 
= "image/jpeg";
一个生成Validatecode 的代码。            
int width = 50;
一个生成Validatecode 的代码。            
int height = 25;
一个生成Validatecode 的代码。            Bitmap bmp 
= new Bitmap(width, height, PixelFormat.Format24bppRgb);
一个生成Validatecode 的代码。            Graphics g 
= Graphics.FromImage(bmp);
一个生成Validatecode 的代码。            HatchBrush b 
= new HatchBrush(HatchStyle.Cross, Color.LightGray, Color.WhiteSmoke);
一个生成Validatecode 的代码。            g.FillRectangle(b, 
00, width, height);
一个生成Validatecode 的代码。            Random r 
= new Random(Convert.ToInt32(DateTime.Now.Millisecond));
一个生成Validatecode 的代码。            
string Code = r.Next(10009999).ToString();
一个生成Validatecode 的代码。            Session[
"ValidateCode"= Code;
一个生成Validatecode 的代码。            g.DrawString(Code, 
new Font("Arial"10, FontStyle.Bold), SystemBrushes.WindowText, 10.0F5.0F);
一个生成Validatecode 的代码。            bmp.Save(Response.OutputStream, ImageFormat.Jpeg);
一个生成Validatecode 的代码。            b.Dispose();
一个生成Validatecode 的代码。            g.Dispose();
一个生成Validatecode 的代码。            bmp.Dispose();
一个生成Validatecode 的代码。            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
相关资源
相似解决方案