//验证码
string code = string.Empty;
//用于生成验证码的字符集
char[] character = { '2', '3', '4', '5', '6', '8', '9',
'A', 'B', 'C', 'D', 'E', 'F', 'G',
'H', 'J','K', 'L', 'M', 'N', 'P',
'R', 'S', 'T', 'W', 'X', 'Y' };
//生成随机数
Random rnd = new Random();
public LoadPage()
{
InitializeComponent();
CreatCodeImage();
}
private void CreatCodeImage()
{
//生成验证码字符串
for (int i = 0; i < 4; i++)
{
if (i == 3)
{
code += character[rnd.Next(character.Length)];
}
else
{
code += character[rnd.Next(character.Length)];
code += " ";
}
}
//label_Code.Content = code;
}
private void label_Code_MouseDown(object sender, MouseButtonEventArgs e)
{
CreatCodeImage();
}