protected virtual bool HandleNCHitTest(ref Message m) { int x = Control.LowOrder((int)m.LParam.ToInt32()); int y = Control.HighOrder((int)m.LParam.ToInt32()); NCPointToClient(ref x, ref y); FormPos pos = FormPosForCoords(x, y); if (pos == FormPos.TitleBar) { m.Result = new IntPtr((int)HitTest.HTCAPTION); return(true); } if (!IsSizable) { return(false); } switch (pos) { case FormPos.Top: m.Result = new IntPtr((int)HitTest.HTTOP); break; case FormPos.Left: m.Result = new IntPtr((int)HitTest.HTLEFT); break; case FormPos.Right: m.Result = new IntPtr((int)HitTest.HTRIGHT); break; case FormPos.Bottom: m.Result = new IntPtr((int)HitTest.HTBOTTOM); break; case FormPos.TopLeft: m.Result = new IntPtr((int)HitTest.HTTOPLEFT); break; case FormPos.TopRight: m.Result = new IntPtr((int)HitTest.HTTOPRIGHT); break; case FormPos.BottomLeft: m.Result = new IntPtr((int)HitTest.HTBOTTOMLEFT); break; case FormPos.BottomRight: m.Result = new IntPtr((int)HitTest.HTBOTTOMRIGHT); break; default: // We return false so that DefWndProc handles things return(false); } return(true); }
private bool HandleNCLButtonUp(ref Message m) { if (form.Capture) { ClearVirtualPosition(); form.Capture = false; state = State.Idle; if (form.MdiContainer != null) { form.MdiContainer.SizeScrollBars(); } } int x = Control.LowOrder((int)m.LParam.ToInt32()); int y = Control.HighOrder((int)m.LParam.ToInt32()); NCPointToClient(ref x, ref y); FormPos pos = FormPosForCoords(x, y); if (pos == FormPos.TitleBar) { HandleTitleBarUp(x, y); return(true); } return(true); }
protected virtual void HandleNCLButtonDblClick(ref Message m) { int x = Control.LowOrder((int)m.LParam.ToInt32()); int y = Control.HighOrder((int)m.LParam.ToInt32()); // Need to adjust because we are in NC land NCPointToClient(ref x, ref y); FormPos pos = FormPosForCoords(x, y); if (pos == FormPos.TitleBar || pos == FormPos.Top) { HandleTitleBarDoubleClick(x, y); } }
protected virtual bool HandleNCMouseLeave(ref Message m) { int x = Control.LowOrder((int)m.LParam.ToInt32()); int y = Control.HighOrder((int)m.LParam.ToInt32()); NCPointToClient(ref x, ref y); FormPos pos = FormPosForCoords(x, y); if (pos != FormPos.TitleBar) { HandleTitleBarLeave(x, y); return(true); } return(true); }
protected virtual bool HandleNCLButtonDown(ref Message m) { Activate(); start = Cursor.Position; virtual_position = form.Bounds; int x = Control.LowOrder((int)m.LParam.ToInt32()); int y = Control.HighOrder((int)m.LParam.ToInt32()); // Need to adjust because we are in NC land NCPointToClient(ref x, ref y); FormPos pos = FormPosForCoords(x, y); if (form.ActiveMenu != null && XplatUI.IsEnabled(form.Handle)) { MouseEventArgs mea = new MouseEventArgs(Form.FromParamToMouseButtons(m.WParam.ToInt32()), form.mouse_clicks, x, y - TitleBarHeight, 0); form.ActiveMenu.OnMouseDown(form, mea); } if (pos == FormPos.TitleBar) { HandleTitleBarDown(x, y); return(true); } if (IsSizable) { if ((pos & FormPos.AnyEdge) == 0) { return(false); } virtual_position = form.Bounds; state = State.Sizing; sizing_edge = pos; form.Capture = true; return(true); } return(false); }
protected virtual bool HandleNCMouseMove(ref Message m) { int x = Control.LowOrder((int)m.LParam.ToInt32( )); int y = Control.HighOrder((int)m.LParam.ToInt32( )); NCPointToClient(ref x, ref y); FormPos pos = FormPosForCoords(x, y); if (pos == FormPos.TitleBar) { HandleTitleBarMouseMove(x, y); return(true); } if (form.ActiveMenu != null && XplatUI.IsEnabled(form.Handle)) { MouseEventArgs mea = new MouseEventArgs(Form.FromParamToMouseButtons(m.WParam.ToInt32()), form.mouse_clicks, x, y, 0); form.ActiveMenu.OnMouseMove(form, mea); } return(true); }
protected virtual bool HandleNCLButtonDown(ref Message m) { Activate(); start = Cursor.Position; virtual_position = form.Bounds; int x = Control.LowOrder((int)m.LParam.ToInt32()); int y = Control.HighOrder((int)m.LParam.ToInt32()); // Need to adjust because we are in NC land NCPointToClient(ref x, ref y); FormPos pos = FormPosForCoords(x, y); if (pos == FormPos.TitleBar) { HandleTitleBarDown(x, y); return(true); } if (IsSizable) { if ((pos & FormPos.AnyEdge) == 0) { return(false); } virtual_position = form.Bounds; state = State.Sizing; sizing_edge = pos; form.Capture = true; return(true); } return(false); }
protected virtual bool HandleNCLButtonDown (ref Message m) { Activate (); start = Cursor.Position; virtual_position = form.Bounds; int x = Control.LowOrder ((int) m.LParam.ToInt32 ()); int y = Control.HighOrder ((int) m.LParam.ToInt32 ()); // Need to adjust because we are in NC land NCPointToClient (ref x, ref y); FormPos pos = FormPosForCoords (x, y); if (form.ActiveMenu != null && XplatUI.IsEnabled (form.Handle)) { MouseEventArgs mea = new MouseEventArgs (Form.FromParamToMouseButtons (m.WParam.ToInt32 ()), form.mouse_clicks, x, y - TitleBarHeight, 0); form.ActiveMenu.OnMouseDown (form, mea); } if (pos == FormPos.TitleBar) { HandleTitleBarDown (x, y); return true; } if (IsSizable) { if ((pos & FormPos.AnyEdge) == 0) return false; virtual_position = form.Bounds; state = State.Sizing; sizing_edge = pos; form.Capture = true; return true; } return false; }