protected override void WndProc(ref Message m) { switch ((Msg)m.Msg) { // If the mouse is over the size grip, change the cursor case Msg.WM_MOUSEMOVE: { if (FromParamToMouseButtons((int)m.WParam.ToInt32()) == MouseButtons.None) { Point p = new Point(LowOrder((int)m.LParam.ToInt32()), HighOrder((int)m.LParam.ToInt32())); if (this.SizingGrip && this.SizeGripBounds.Contains(p)) { this.Cursor = Cursors.SizeNWSE; return; } else { this.Cursor = Cursors.Default; } } break; } // If the left mouse button is pushed over the size grip, // send the WM a message to begin a window resize operation case Msg.WM_LBUTTONDOWN: { Point p = new Point(LowOrder((int)m.LParam.ToInt32()), HighOrder((int)m.LParam.ToInt32())); Form form = FindForm(); if (this.SizingGrip && this.SizeGripBounds.Contains(p)) { // For top level forms it's not enoug to send a NCLBUTTONDOWN message, so // we make a direct call to our XplatUI engine. if (!form.IsMdiChild) { XplatUI.BeginMoveResize(form.Handle); } XplatUI.SendMessage(form.Handle, Msg.WM_NCLBUTTONDOWN, (IntPtr)HitTest.HTBOTTOMRIGHT, IntPtr.Zero); return; } break; } } base.WndProc(ref m); }