用线程实现窗口抖动
下面是代码过程
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,
C#窗体抖动与随机验证码实现技巧

本文介绍了如何在C#中实现窗体抖动,包括通过线程和Timer两种方式,并详细讲解了随机验证码的生成,包括三种不同的方法,涉及颜色和字体大小的随机变化。文章末尾邀请读者对不足之处提出指正。
最低0.47元/天 解锁文章
1334

被折叠的 条评论
为什么被折叠?



