/// <summary> /// Processes Windows messages. /// </summary> /// <param name="m">The Windows Message to process. </param> protected override void WndProc(ref Message m) { switch (m.Msg) { case PI.WM_.NCLBUTTONDOWN: { // Perform a hit test to determine which area the mouse press is over at the moment uint result = PI.SendMessage(Handle, PI.WM_.NCHITTEST, IntPtr.Zero, m.LParam); // Only want to override the behaviour of moving the window via the caption bar if (result == PI.HT.CAPTION) { // Extract screen position of the mouse from the message LPARAM Point screenPos = new Point(PI.LOWORD(m.LParam), PI.HIWORD(m.LParam)); // Find the mouse offset relative to the top left of the window Point offset = new Point(screenPos.X - Location.X, screenPos.Y - Location.Y); // Do not intercept message if inside the max/close buttons if (!HitTestMaxButton(offset) && !HitTestCloseButton(offset)) { // Capture the mouse until the mouse us is received and gain focus so we look active Capture = true; Activate(); // Use event to notify the request to drag the window OnWindowCaptionDragging(new ScreenAndOffsetEventArgs(screenPos, offset)); // Eat the message! return; } } } break; case PI.WM_.KEYDOWN: base.WndProc(ref m); FloatingMessages?.OnKEYDOWN(ref m); return; case PI.WM_.MOUSEMOVE: base.WndProc(ref m); FloatingMessages?.OnMOUSEMOVE(); return; case PI.WM_.LBUTTONUP: base.WndProc(ref m); FloatingMessages?.OnLBUTTONUP(); return; } base.WndProc(ref m); }
internal void WndProc(ref Message m) { switch (m.Msg) { case PI.WM_.ACTIVATE: if ((PI.LOWORD(m.WParam) == 0) && // WA_INACTIVE (PI.HIWORD(m.WParam) == 0) ) { if (_blurValues.BlurWhenFocusLost || (Form.ActiveForm != null) ) { DoTheBlur(); } } else { RemoveBlur(); } break; } }
bool IMessageFilter.PreFilterMessage(ref Message m) { if (!Enabled || !Visible || IsDisposed) { return(false); } if (m.Msg == PI.WM_MOUSEWHEEL) { //don't filter when scroll bar is not visible if (!engineScrollBar1.Visible) { return(false); } //if( VerticalScroll == null || !VerticalScroll.Visible ) // return false; Point pos = new Point(PI.LOWORD((int)m.LParam), PI.HIWORD((int)m.LParam)); try //crashed once on ObjectsWindow. access to disposed object assertion. { Control foundControl = GetChildAtPoint(PointToClient(pos)); if (foundControl == null) { return(false); } if (foundControl == engineScrollBar1) { return(false); } //!!!!было //if( !( foundControl is IHCProperty ) ) // return false; if (dropDownHolder != null && dropDownHolder.Visible) { return(false); } if (IsDropDownListAtPoint(pos)) { return(false); } int delta = (short)((((long)m.WParam) >> 0x10) & 0xffff); int scrollStep = delta / 120; //System.Windows.Input.Mouse.MouseWheelDeltaForOneLine; var newValue = engineScrollBar1.Value - 100 * scrollStep; engineScrollBar1.Value = newValue; //// send message to HierarchicalContainer, and ignore other controls //PI.SendMessage( this.Handle, m.Msg, m.WParam, m.LParam ); return(true); } catch { } } return(false); }