C# Class LightFramework.Web.ImageValidCodeHelper

生成图片验证码的类。
Show file Open project: xianrendzw/LightFramework.Net

Public Methods

Method Description
GenValidateCode ( ) : string

生成默认长度(5位字符)的验证码

GenValidateCode ( int len ) : string

生成指定长度的验证码

GenValidateCode ( int len, bool isOnlyNumber ) : string

生成指定长度的验证码

OutputValidateCodeImage ( string code, int width, int height, Color bgcolor, int textcolor ) : byte[]

生成验证码图片

OutputValidateCodeImage ( System response, string validateCode ) : void

输出验证码图片,默认图片宽度是80,高度30,文字大小是18号

OutputValidateCodeImage ( System response, string validateCode, float fontSize ) : void

输出验证码图片,默认图片宽度是80,高度30,文字大小是18号

OutputValidateCodeImage ( System response, string validateCode, float fontSize, int height ) : void

输出验证码图片

OutputValidateCodeImage ( System response, string validateCode, float fontSize, int width, int height ) : void

输出验证码图片

OutputValidateCodeImage ( System response, string validateCode, float fontSize, int width, int height, Color bgcolor, Color txcolor, FontStyle fontStyle, string contentType ) : void

输出验证码图片,支持png和jpeg

Private Methods

Method Description
Next ( int max ) : int

获得下一个随机数

Next ( int min, int max ) : int

获得下一个随机数

Method Details

GenValidateCode() public static method

生成默认长度(5位字符)的验证码
public static GenValidateCode ( ) : string
return string

GenValidateCode() public static method

生成指定长度的验证码
public static GenValidateCode ( int len ) : string
len int 验证码的长度
return string

GenValidateCode() public static method

生成指定长度的验证码
public static GenValidateCode ( int len, bool isOnlyNumber ) : string
len int 验证码的长度
isOnlyNumber bool
return string

OutputValidateCodeImage() public static method

生成验证码图片
public static OutputValidateCodeImage ( string code, int width, int height, Color bgcolor, int textcolor ) : byte[]
code string 要显示的验证码
width int 宽度
height int 高度
bgcolor Color 背景色
textcolor int 文字颜色
return byte[]

OutputValidateCodeImage() public static method

输出验证码图片,默认图片宽度是80,高度30,文字大小是18号
public static OutputValidateCodeImage ( System response, string validateCode ) : void
response System HttpResponse对象
validateCode string 验证码字符串
return void

OutputValidateCodeImage() public static method

输出验证码图片,默认图片宽度是80,高度30,文字大小是18号
public static OutputValidateCodeImage ( System response, string validateCode, float fontSize ) : void
response System HttpResponse对象
validateCode string 验证码字符串
fontSize float 字体大小
return void

OutputValidateCodeImage() public static method

输出验证码图片
public static OutputValidateCodeImage ( System response, string validateCode, float fontSize, int height ) : void
response System HttpResponse对象
validateCode string 验证码字符串
fontSize float 字体大小
height int 图片高度
return void

OutputValidateCodeImage() public static method

输出验证码图片
public static OutputValidateCodeImage ( System response, string validateCode, float fontSize, int width, int height ) : void
response System HttpResponse对象
validateCode string 验证码字符串
fontSize float 字体大小
width int 图片宽度
height int 图片高度
return void

OutputValidateCodeImage() public static method

输出验证码图片,支持png和jpeg
public static OutputValidateCodeImage ( System response, string validateCode, float fontSize, int width, int height, Color bgcolor, Color txcolor, FontStyle fontStyle, string contentType ) : void
response System HttpResponse对象
validateCode string 验证码字符串
fontSize float 字体大小
width int 图片宽度
height int 图片高度
bgcolor Color
txcolor Color
fontStyle FontStyle
contentType string
return void