首页 > 代码库 > 简单验证证码代码(from-sysoft.cc)

简单验证证码代码(from-sysoft.cc)

using (Bitmap bit = new Bitmap(60, 20))            {                Graphics g = Graphics.FromImage(bit);                g.FillRectangle(Brushes.White, 1, 1, bit.Width - 2, bit.Height - 2);                Random rand = new Random();                string code = rand.Next(100000, 1000000).ToString();                context.Session["code"] = code;                g.DrawString(code, new Font("黑体", 12), Brushes.Black, new PointF(1, 1));                bit.Save(context.Response.OutputStream,ImageFormat.Jpeg);            }

 

简单验证证码代码(from-sysoft.cc)