/// <summary> /// 过滤键盘消息 /// Filters out a key message before it is dispatched /// </summary> /// <param name="target">The Control that will receive the message</param> /// <param name="msg">A WindowMessage that represents the message to process</param> /// <param name="wParam">Specifies the WParam field of the message</param> /// <param name="lParam">Specifies the LParam field of the message</param> /// <returns>true to filter the message and prevent it from being dispatched; /// false to allow the message to continue to the next filter or control</returns> public override bool ProcessKeyMessage(Control target, I3WindowMessage msg, int wParam, int lParam) { if (msg == I3WindowMessage.WM_KEYDOWN) { if (((Keys)wParam) == Keys.F4) { if (this.TextBox.Focused || this.DropDown.ContainsFocus) { this.DroppedDown = !this.DroppedDown; return(true); } } } return(false); }
/// <summary> /// 虚拟方法,过滤鼠标消息 /// Filters out a mouse message before it is dispatched /// </summary> /// <param name="target">The Control that will receive the message</param> /// <param name="msg">A WindowMessage that represents the message to process</param> /// <param name="wParam">Specifies the WParam field of the message</param> /// <param name="lParam">Specifies the LParam field of the message</param> /// <returns>true to filter the message and prevent it from being dispatched; /// false to allow the message to continue to the next filter or control</returns> public virtual bool ProcessMouseMessage(Control target, I3WindowMessage msg, int wParam, int lParam) { if (msg == I3WindowMessage.WM_LBUTTONDOWN || msg == I3WindowMessage.WM_RBUTTONDOWN || msg == I3WindowMessage.WM_MBUTTONDOWN || msg == I3WindowMessage.WM_XBUTTONDOWN || msg == I3WindowMessage.WM_NCLBUTTONDOWN || msg == I3WindowMessage.WM_NCRBUTTONDOWN || msg == I3WindowMessage.WM_NCMBUTTONDOWN || msg == I3WindowMessage.WM_NCXBUTTONDOWN) { Point cursorPos = Cursor.Position; if (target != this.EditingTable && target != this.Control) { this.EditingTable.StopEditing(); } } return(false); }
/// <summary> /// 过滤鼠标消息 /// Filters out a mouse message before it is dispatched /// </summary> /// <param name="target">The Control that will receive the message</param> /// <param name="msg">A WindowMessage that represents the message to process</param> /// <param name="wParam">Specifies the WParam field of the message</param> /// <param name="lParam">Specifies the LParam field of the message</param> /// <returns>true to filter the message and prevent it from being dispatched; /// false to allow the message to continue to the next filter or control</returns> public override bool ProcessMouseMessage(Control target, I3WindowMessage msg, int wParam, int lParam) { if (this.DroppedDown) { if (msg == I3WindowMessage.WM_LBUTTONDOWN || msg == I3WindowMessage.WM_RBUTTONDOWN || msg == I3WindowMessage.WM_MBUTTONDOWN || msg == I3WindowMessage.WM_XBUTTONDOWN || msg == I3WindowMessage.WM_NCLBUTTONDOWN || msg == I3WindowMessage.WM_NCRBUTTONDOWN || msg == I3WindowMessage.WM_NCMBUTTONDOWN || msg == I3WindowMessage.WM_NCXBUTTONDOWN) { Point cursorPos = Cursor.Position; if (!this.DropDown.Bounds.Contains(cursorPos)) { if (target != this.EditingTable && target != this.TextBox) { if (this.ShouldStopEditing(target, cursorPos)) { this.EditingTable.StopEditing(); } } } } else if (msg == I3WindowMessage.WM_MOUSEMOVE) { Point cursorPos = Cursor.Position; if (this.DropDown.Bounds.Contains(cursorPos)) { if (!this.containsMouse) { this.containsMouse = true; this.EditingTable.RaiseCellMouseLeave(this.EditingCellPos); } } else { this.containsMouse = true; } } } return(false); }
/// <summary> /// 虚拟方法,过滤键盘消息 /// Filters out a key message before it is dispatched /// </summary> /// <param name="target">The Control that will receive the message</param> /// <param name="msg">A WindowMessage that represents the message to process</param> /// <param name="wParam">Specifies the WParam field of the message</param> /// <param name="lParam">Specifies the LParam field of the message</param> /// <returns>true to filter the message and prevent it from being dispatched; /// false to allow the message to continue to the next filter or control</returns> public virtual bool ProcessKeyMessage(Control target, I3WindowMessage msg, int wParam, int lParam) { return(false); }