首页 > Windows开发 > 详细

winform窗体抖动

时间:2015-10-20 12:15:10      阅读:236      评论:0      收藏:0      [点我收藏+]
 private void button1_Click(object sender, EventArgs e)
    {
      //实现窗体抖动的效果
      Point first = this.Location;
      for (int i = 0; i < 50; i++)
      {
        Application.DoEvents();
        Random ran = new Random();
        Point p = new Point(this.Location.X + ran.Next(10) - 4, this.Location.Y +
            ran.Next(10) - 4);
        System.Threading.Thread.Sleep(10);//当前线程再挂起15毫秒
        this.Location = p;
        System.Threading.Thread.Sleep(10);//当前线程再挂起15毫秒
        Application.DoEvents();

      }
      this.Location = first;   //将窗体还原为原来的位置    
    }

 

winform窗体抖动

原文:http://www.cnblogs.com/Iyce/p/4894256.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!