码迷,mamicode.com
首页 > 移动开发 > 详细

窗体移动

时间:2015-11-13 14:30:14      阅读:199      评论:0      收藏:0      [点我收藏+]

标签:

                int x,y;
        void MainFormMouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                x = e.X;
                y = e.Y;
            }
        }
        void MainFormMouseMove(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                this.Location = new Point(this.Location.X + (e.X - x), this.Location.Y + (e.Y - y));
            }
        }

 

窗体移动

标签:

原文地址:http://www.cnblogs.com/CJSTONE/p/4961853.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!