C#实现窗体抖动功能

QQ2009版和2010版都有窗体抖动的功能

其实这个功能在C#中也可以实现。

改变窗体的位置,间隔一定时间,但必须是围绕起始位置改变窗体位置,否则就只是窗体的移动。

 

ExpandedBlockStart.gif代码
 1 using System;
 2 using System.Drawing;
 3 using System.Windows.Forms;
 4 
 5 namespace HendyZhuBlog
 6 {
 7     public partial class Form1 : Form
 8     {
 9         public Form1()
10         {
11             InitializeComponent();
12         }
13 
14         private void button1_Click(object sender, EventArgs e)
15         {
16             Random ran = new Random((int)DateTime.Now.Ticks);
17             Point point = this.Location;
18             for (int i = 0; i < 40; i++)
19             {
20                 this.Location = new Point(point.X + ran.Next(8- 4, point.Y + ran.Next(8- 4);
21                 System.Threading.Thread.Sleep(10);
22                 this.Location = point;
23                 System.Threading.Thread.Sleep(10);
24             }
25         }
26     }
27 }

 

 

 

转载于:https://www.cnblogs.com/hendy/archive/2010/06/23/1763034.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值