Ejemplo n.º 1
0
 /// <summary>
 /// 鼠标移动事件:让控件跟着鼠标移动
 /// </summary>
 void FrameControl_MouseMove(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         this.Visible = false;
         SetControlsDragMove.DrawDragBound(baseControl);
         ControlMove();
     }
     else
     {
         this.Visible = true;
         SetCursorShape(e.X, e.Y); //更新鼠标指针样式
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 鼠标移动事件:让控件跟着鼠标移动
 /// </summary>
 void MouseMove(object sender, MouseEventArgs e)
 {
     Cursor.Current = Cursors.SizeAll; //当鼠标处于控件内部时,显示光标样式为SizeAll
     //当鼠标左键按下时才触发
     if (e.Button == MouseButtons.Left)
     {
         SetControlsDragMove.DrawDragBound(this._currentControl);
         //if(_fc != null ) _fc.Visible = false; //先隐藏
         _cPoint = Cursor.Position;//获得当前鼠标位置
         int x = _cPoint.X - _pPoint.X;
         int y = _cPoint.Y - _pPoint.Y;
         _currentControl.Location = new Point(_currentControl.Location.X + x, _currentControl.Location.Y + y);
         _pPoint = _cPoint;
     }
 }