1、支持自定义图像尺寸,能够自适应任何尺寸(当然,建议不要太小)
2、支持自定义边框大小
3、支持自定义噪点、干扰线、干扰色块的数量
4、支持自定义文本阴影颜色及其透明度
5、支持自定义验证码文本,完全支持中文(这个不是特色)
6、为文本、边框、噪点、干扰线、干扰色块等支持随机色彩
本类封装度高,调用简单、灵活,非常便于二次开发。
protected override void OnInit(EventArgs e)
{
VerificationImage image = new VerificationImage();
image.Width = 185;
image.Height = 55;
image.BorderWidth = 1;
image.BadPiont = 200;
image.StrukLineCount = 8;
image.PatternCount = 6;
image.BorderInsetColor = System.Drawing.Color.LightGray;
image.BorderOutsetColor = System.Drawing.Color.Empty;
image.Text = Utils.String.GetRnd(5, true, true, true, false, "");
image.CreateImage();
Response.ClearContent();
Response.Expires = -1;
Response.ExpiresAbsolute = DateTime.Now.AddHours(-1);
Response.ContentType = "image/png";
Response.BinaryWrite(image.Stream.ToArray());
}