用线程实现窗口抖动
下面是代码过程
private void Form2_Load(object sender, EventArgs e)
{
this.CenterToScreen();
}
private void douyidou_Click(object sender, EventArgs e)
{
for (int i = 0; i < 20; i++)
{
this.Location = new Point(this.Left + 10,this.Top );
Thread.Sleep(10);
this.Location = new Point(this.Left, this.Top + 10);
Thread.Sleep(10);
this.Location = new Point(this.Left - 10, this.Top);
Thread.Sleep(10);
this.Location = new Point(this.Left - 10, this.Top);
Thread.Sleep(10);
this.Location = new Point(this.Left, this.Top - 10);
Thread.Sleep(10);
this.Location = new Point(this.Left, this.Top - 10);
Thread.Sleep(10);
this.Location = new Point(this.Left + 10, this.Top);
Thread.Sleep(10);
this.Location = new Point(this.Left + 10, this.Top);
Thread.Sleep(10);
this.Location = new Point(this.Left, this.Top + 10);
Thread.Sleep(10);
this.Location = new Point(this.Left - 10, this.Top);
Thread.Sleep(10);
}
}
}
}
随机验证码
1)第一种方法:
private void yanzhengma_Click(object sender, EventArgs e)
{
string ai = "";
Random p = new Random();
for (int i = 0; i < 4; i++)
{
int type = p.Next(0, 3