跪求!!我想用C#实现qq抖动窗口。给详细讲解一下代码。谢谢! 不就是让窗体的location晃动一下吗 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 是否是用timer启发窗体坐标短时间变化?我也是新手以上只是我个人想法 private void button2_Click(object sender, EventArgs e) { int recordx = this.Left; int recordy = this.Top; Random random = new Random(); for (int i = 0; i < 50; i++) { int x = random.Next(rand); int y = random.Next(rand); if (x % 2 == 0) { this.Left = this.Left + x; } else { this.Left = this.Left - x; } if (y % 2 == 0) { this.Top = this.Top + y; } else { this.Top = this.Top - y; } System.Threading.Thread.Sleep(1); } this.Left = recordx; this.Top = recordy; } private void button2_Click(object sender, EventArgs e) { int recordx = this.Left; int recordy = this.Top; Random random = new Random(); for (int i = 0; i < 50; i++) { int x = random.Next(rand); int y = random.Next(rand); if (x % 2 == 0) { this.Left = this.Left + x; } else { this.Left = this.Left - x; } if (y % 2 == 0) { this.Top = this.Top + y; } else { this.Top = this.Top - y; } System.Threading.Thread.Sleep(1); } this.Left = recordx; this.Top = recordy; }看看MyQQ。 double dob = 0; private void timer1_Tick(object sender, EventArgs e) { //每次增加角度数 dob += 30; //数字3为窗口抖动的半径 this.Location = new Point(this.Location.X +Convert.ToInt32( Math.Sin(dob)*3), this.Location.Y +Convert.ToInt32( Math.Cos(dob)*3)); if(dob>720) { dob = 0; timer1.Enabled = false; } } double dob = 0; private void timer1_Tick(object sender, EventArgs e) { //每次增加角度数 dob += 30; //数字3为窗口抖动的半径 this.Location = new Point(this.Location.X +Convert.ToInt32( Math.Sin(dob)*3), this.Location.Y +Convert.ToInt32( Math.Cos(dob)*3)); if(dob>720) { dob = 0; timer1.Enabled = false; } } DataGridView 组合字段自动更新到数据库 如何在windows 应用程序中显示繁体中文 任务 急急 求pudn 可用帐号下载一个程序 关于FileInfo 类的对象赋值问题 发布C#应用程序时遇到的问题 如何得到放置ACCESS数据库的服务器的系统时间 c# HttpWebRequest 使用代理IP 和IE使用代理IP的区别? 请教泛型Collection<T>和ICollection<T>的区别! 关于钉钉考勤成功闸机开闸 如何修改表中某项的值? 业务逻辑的编写
{
int recordx = this.Left;
int recordy = this.Top;
Random random = new Random();
for (int i = 0; i < 50; i++)
{
int x = random.Next(rand);
int y = random.Next(rand);
if (x % 2 == 0)
{
this.Left = this.Left + x;
}
else
{
this.Left = this.Left - x;
}
if (y % 2 == 0)
{
this.Top = this.Top + y;
}
else
{
this.Top = this.Top - y;
}
System.Threading.Thread.Sleep(1);
}
this.Left = recordx;
this.Top = recordy;
}
{
int recordx = this.Left;
int recordy = this.Top;
Random random = new Random();
for (int i = 0; i < 50; i++)
{
int x = random.Next(rand);
int y = random.Next(rand);
if (x % 2 == 0)
{
this.Left = this.Left + x;
}
else
{
this.Left = this.Left - x;
}
if (y % 2 == 0)
{
this.Top = this.Top + y;
}
else
{
this.Top = this.Top - y;
}
System.Threading.Thread.Sleep(1);
}
this.Left = recordx;
this.Top = recordy;
}
看看MyQQ。
private void timer1_Tick(object sender, EventArgs e)
{
//每次增加角度数
dob += 30;
//数字3为窗口抖动的半径
this.Location = new Point(this.Location.X +Convert.ToInt32( Math.Sin(dob)*3), this.Location.Y +Convert.ToInt32( Math.Cos(dob)*3));
if(dob>720)
{
dob = 0;
timer1.Enabled = false;
}
}
private void timer1_Tick(object sender, EventArgs e)
{
//每次增加角度数
dob += 30;
//数字3为窗口抖动的半径
this.Location = new Point(this.Location.X +Convert.ToInt32( Math.Sin(dob)*3), this.Location.Y +Convert.ToInt32( Math.Cos(dob)*3));
if(dob>720)
{
dob = 0;
timer1.Enabled = false;
}
}