C# Класс LightFramework.Web.ImageValidCodeHelper

生成图片验证码的类。
Показать файл Открыть проект

Открытые методы

Метод Описание
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

Приватные методы

Метод Описание
Next ( int max ) : int

获得下一个随机数

Next ( int min, int max ) : int

获得下一个随机数

Описание методов

GenValidateCode() публичный статический Метод

生成默认长度(5位字符)的验证码
public static GenValidateCode ( ) : string
Результат string

GenValidateCode() публичный статический Метод

生成指定长度的验证码
public static GenValidateCode ( int len ) : string
len int 验证码的长度
Результат string

GenValidateCode() публичный статический Метод

生成指定长度的验证码
public static GenValidateCode ( int len, bool isOnlyNumber ) : string
len int 验证码的长度
isOnlyNumber bool
Результат string

OutputValidateCodeImage() публичный статический Метод

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

OutputValidateCodeImage() публичный статический Метод

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

OutputValidateCodeImage() публичный статический Метод

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

OutputValidateCodeImage() публичный статический Метод

输出验证码图片
public static OutputValidateCodeImage ( System response, string validateCode, float fontSize, int height ) : void
response System HttpResponse对象
validateCode string 验证码字符串
fontSize float 字体大小
height int 图片高度
Результат void

OutputValidateCodeImage() публичный статический Метод

输出验证码图片
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 图片高度
Результат void

OutputValidateCodeImage() публичный статический Метод

输出验证码图片,支持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
Результат void