using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace 验证码2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
Random r = new Random();
private void button1_Click_1(object sender, EventArgs e)
{
string code = "";
for (int a = 0; a < 4; a++)
{
int type = r.Next(0, 2);
if (type == 0)
{
code = code + r.Next(0, 9);
}
else if (type == 1)
{
code += (char)r.Next(65, 91);
}
}
label1.Text = code;
label1.ForeColor = Color.FromArgb(r.Next(256), r.Next(256), r.Next(256));
label1.Font = new Font("", 20, FontStyle.Bold);
}
}
}
随机验证码
最新推荐文章于 2020-09-16 12:43:53 发布