关于设置校验码字体颜色的问题
各位老师,下面是我搞到的校验码例程,但我不知道设置校验码字体颜色的代码在那里,看了半天好像没有,请各位老师指点一下校验码字体颜色如何设置
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Drawing.Text;
using System.Drawing;
using System.Text;
public partial class ValidateImage : System.Web.UI.Page
{
private readonly string ImagePath = "Images/Validator.jpg ";
private string sValidator = " ";
private Brush[] BrushList = new Brush[32];
private void Page_Load(object sender, System.EventArgs e)
{
///初始化
InitBrushList();
if(Request.Params[ "Validator "] != null)
{
///获取验证字符串
sValidator = Request.Params[ "Validator "].ToString();
}
///创建Bmp位图
Bitmap bitMapImage = new System.Drawing.Bitmap(Server.MapPath(ImagePath));
Graphics graphicImage = Graphics.FromImage(bitMapImage);
///设置画笔的输出模式
graphicImage.SmoothingMode = SmoothingMode.AntiAlias;
///添加文本字符串
///
for(int i = 0; i < sValidator.Length; i++)
{
graphicImage.DrawString(sValidator[i].ToString(),
new Font( "Arial ", 25, (FontStyle)CreateRandomFontStyle(GetRandomint(0, 1000))),
BrushList[GetRandomint(0, BrushList.Length - 1)],
new PointF(i * 20, GetRandomint(-5, 5)));
}
//graphicImage.DrawString(sValidator, new Font( "Arial ", 20,