using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Text;
using System.Drawing;
namespace VerifyColorCode
{
public partial class VerifyCode : System.Web.UI.Page
{
public Encoding GB = Encoding.GetEncoding("GB2312");
protected void Page_Load(object sender, EventArgs e)
{
VerifyCode v = new VerifyCode();
v.Length = this.length;
v.FontSize = this.fontSize;
v.Chaos = this.chaos;
v.BackgroundColor = this.backgroundColor;
v.ChaosColor = this.chaosColor;
v.CodeSerial = this.codeSerial;
v.Colors = this.colors;
v.Fonts = this.fonts;
v.Padding = this.padding;
string code = v.CreateVerifyCode(); //取随机码
v.CreateImageOnPage(code, this.Context); // 输出图片
Response.Cookies.Add(new HttpCookie("CheckCode", code.ToUpper()));// 使用Cookies取验证码的值
}
验证码长度(默认6个验证码的长度)
验证码字体大小(为了显示扭曲效果,默认40像素,可以自行修改)
边框补(默认1像素)
是否输出燥点(默认不输出)
输出燥点的颜色(默认灰色)
自定义背景色(默认白色)
自定义随机颜色数组
自定义字体数组
自定义随机码字符串序列(使用逗号分隔)
产生波形滤镜效果
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Text;
using System.Drawing;
namespace VerifyColorCode
{
public partial class VerifyCode : System.Web.UI.Page
{
public Encoding GB = Encoding.GetEncoding("GB2312");
protected void Page_Load(object sender, EventArgs e)
{
VerifyCode v = new VerifyCode();
v.Length = this.length;
v.FontSize = this.fontSize;
v.Chaos = this.chaos;
v.BackgroundColor = this.backgroundColor;
v.ChaosColor = this.chaosColor;
v.CodeSerial = this.codeSerial;
v.Colors = this.colors;
v.Fonts = this.fonts;
v.Padding = this.padding;
string code = v.CreateVerifyCode(); //取随机码
v.CreateImageOnPage(code, this.Context); // 输出图片
Response.Cookies.Add(new HttpCookie("CheckCode", code.ToUpper()));// 使用Cookies取验证码的值
}
验证码长度(默认6个验证码的长度)
验证码字体大小(为了显示扭曲效果,默认40像素,可以自行修改)
边框补(默认1像素)
是否输出燥点(默认不输出)
输出燥点的颜色(默认灰色)
自定义背景色(默认白色)
自定义随机颜色数组
自定义字体数组
自定义随机码字符串序列(使用逗号分隔)
产生波形滤镜效果