/// <summary> /// 处理鼠标左键按下消息 /// </summary> /// <param name="m">消息</param> protected virtual void WmLButtonDown(ref Message m) { UIControl control = this.FindUIChild(Util.GetMousePosition(m.LParam)); this.CaptureControl = control = (control != null && control.Enabled) ? control : null; if (control != null) { control.WndProc(ref m); m.Result = NativeMethods.TRUE; } }
/// <summary> /// 处理鼠标移动消息 /// </summary> /// <param name="m">消息</param> protected virtual void WmMouseMove(ref Message m) { if ((Control.MouseButtons & MouseButtons.Left) == MouseButtons.None)//未按下左键 { this.WmLButtonDown(ref m); } else//左键按下 { UIControl lastAccess = this.CaptureControl; if (lastAccess != null) { lastAccess.WndProc(ref m); m.Result = NativeMethods.TRUE; } } }