读书人

无边框窗体拖动有关问题

发布时间: 2012-09-21 15:47:26 作者: rapoo

无边框窗体拖动问题
定义了一个类:

C# code
    class DragForm    {        private int x;        private int y;        private Point yyy;        private bool _t;        public bool t        {            get { return t; }            set { _t = value; }        }        public void setXy(Control f)        {            yyy =f.PointToClient(Control.MousePosition);        }        public void dragForm(Control f)        {            Point xxx = Control.MousePosition;            x = xxx.X;            y = xxx.Y;            if (_t == true)            {                f.Top = y - yyy.Y;                f.Left = x - yyy.X;            }        }    }

类的作用是拖动窗体,但是我可以实现拖动。无法实现像普通有边框窗体拖动时有一个灰色边框的效果。
比如下图~

请问高手,我应该要怎么实现这一的功能呢?

[解决办法]
用标准方法:
如何通过拖动窗体的工作区来移动窗体

读书人网 >C#

热点推荐