private bool OnNcHitTest(ref Message m, bool contentControl) { Point location = PointToClient(new Point(LOWORD(m.LParam), HIWORD(m.LParam))); var transparent = new IntPtr(HTTRANSPARENT); // Check for simple gripper dragging. if (GripBounds.Contains(location)) { if (CompareResizeMode(PopupResizeMode.BottomLeft)) { m.Result = contentControl ? transparent : (IntPtr)HTBOTTOMLEFT; return(true); } else if (CompareResizeMode(PopupResizeMode.BottomRight)) { m.Result = contentControl ? transparent : (IntPtr)HTBOTTOMRIGHT; return(true); } else if (CompareResizeMode(PopupResizeMode.TopLeft)) { m.Result = contentControl ? transparent : (IntPtr)HTTOPLEFT; return(true); } else if (CompareResizeMode(PopupResizeMode.TopRight)) { m.Result = contentControl ? transparent : (IntPtr)HTTOPRIGHT; return(true); } } else // Check for edge based dragging. { Rectangle rectClient = ClientRectangle; if (location.X > rectClient.Right - 3 && location.X <= rectClient.Right && CompareResizeMode(PopupResizeMode.Right)) { m.Result = contentControl ? transparent : (IntPtr)HTRIGHT; return(true); } else if (location.Y > rectClient.Bottom - 3 && location.Y <= rectClient.Bottom && CompareResizeMode(PopupResizeMode.Bottom)) { m.Result = contentControl ? transparent : (IntPtr)HTBOTTOM; return(true); } else if (location.X > -1 && location.X < 3 && CompareResizeMode(PopupResizeMode.Left)) { m.Result = contentControl ? transparent : (IntPtr)HTLEFT; return(true); } else if (location.Y > -1 && location.Y < 3 && CompareResizeMode(PopupResizeMode.Top)) { m.Result = contentControl ? transparent : (IntPtr)HTTOP; return(true); } } return(false); }
private bool OnNcHitTest(ref Message m, bool contentControl) { int x = NativeMethods.LOWORD(m.LParam); int y = NativeMethods.HIWORD(m.LParam); Point clientLocation = PointToClient(new Point(x, y)); var gripBouns = new GripBounds(contentControl ? content.ClientRectangle : ClientRectangle); var transparent = new IntPtr(NativeMethods.HTTRANSPARENT); if (resizableTop) { if (resizableRight && gripBouns.TopLeft.Contains(clientLocation)) { m.Result = contentControl ? transparent : (IntPtr)NativeMethods.HTTOPLEFT; return(true); } if (!resizableRight && gripBouns.TopRight.Contains(clientLocation)) { m.Result = contentControl ? transparent : (IntPtr)NativeMethods.HTTOPRIGHT; return(true); } if (gripBouns.Top.Contains(clientLocation)) { m.Result = contentControl ? transparent : (IntPtr)NativeMethods.HTTOP; return(true); } } else { if (resizableRight && gripBouns.BottomLeft.Contains(clientLocation)) { m.Result = contentControl ? transparent : (IntPtr)NativeMethods.HTBOTTOMLEFT; return(true); } if (!resizableRight && gripBouns.BottomRight.Contains(clientLocation)) { m.Result = contentControl ? transparent : (IntPtr)NativeMethods.HTBOTTOMRIGHT; return(true); } if (gripBouns.Bottom.Contains(clientLocation)) { m.Result = contentControl ? transparent : (IntPtr)NativeMethods.HTBOTTOM; return(true); } } if (resizableRight && gripBouns.Left.Contains(clientLocation)) { m.Result = contentControl ? transparent : (IntPtr)NativeMethods.HTLEFT; return(true); } if (!resizableRight && gripBouns.Right.Contains(clientLocation)) { m.Result = contentControl ? transparent : (IntPtr)NativeMethods.HTRIGHT; return(true); } return(false); }
private bool OnNcHitTest(ref Message m, bool contentControl) { var pt = this.PointToClient(new Point(NativeMethods.LOWORD(m.LParam), NativeMethods.HIWORD(m.LParam))); var gripBounds = new GripBounds(contentControl ? this.content.ClientRectangle : this.ClientRectangle); var num = new IntPtr(-1); if (this.resizableTop) { if (this.resizableLeft && gripBounds.TopLeft.Contains(pt)) { m.Result = contentControl ? num : (IntPtr)13; return(true); } else if (!this.resizableLeft && gripBounds.TopRight.Contains(pt)) { m.Result = contentControl ? num : (IntPtr)14; return(true); } else if (gripBounds.Top.Contains(pt)) { m.Result = contentControl ? num : (IntPtr)12; return(true); } } else if (this.resizableLeft && gripBounds.BottomLeft.Contains(pt)) { m.Result = contentControl ? num : (IntPtr)16; return(true); } else if (!this.resizableLeft && gripBounds.BottomRight.Contains(pt)) { m.Result = contentControl ? num : (IntPtr)17; return(true); } else if (gripBounds.Bottom.Contains(pt)) { m.Result = contentControl ? num : (IntPtr)15; return(true); } if (this.resizableLeft && gripBounds.Left.Contains(pt)) { m.Result = contentControl ? num : (IntPtr)10; return(true); } else { if (this.resizableLeft || !gripBounds.Right.Contains(pt)) { return(false); } m.Result = contentControl ? num : (IntPtr)11; return(true); } }
private bool OnNcHitTest(ref Message m, bool contentControl) { Point location = PointToClient(new Point(Sce.Atf.User32.LOWORD(m.LParam), Sce.Atf.User32.HIWORD(m.LParam))); IntPtr transparent = new IntPtr(HTTRANSPARENT); // Check for simple gripper dragging. if (GripBounds.Contains(location)) { m.Result = contentControl ? transparent : (IntPtr)HTBOTTOMRIGHT; return(true); } return(false); }
/// <summary> /// Occurs when the operating system needs to determine what part of the window corresponds /// to a particular screen coordinate. /// </summary> /// <param name="m"> /// The window message. /// </param> /// <returns> /// true if the message was handled; otherwise false. /// </returns> private bool OnNcHitTest(ref Message m) { Point clientLocation = PointToClient(Cursor.Position); GripBounds gripBounds = new GripBounds(ClientRectangle); if (gripBounds.BottomRight.Contains(clientLocation)) { m.Result = (IntPtr)PI.HT.BOTTOMRIGHT; } else if (gripBounds.Bottom.Contains(clientLocation)) { m.Result = (IntPtr)PI.HT.BOTTOM; } else if (gripBounds.Right.Contains(clientLocation)) { m.Result = (IntPtr)PI.HT.RIGHT; } return m.Result != IntPtr.Zero; }
/// <summary> /// Occurs when the operating system needs to determine what part of the window corresponds /// to a particular screen coordinate. /// </summary> /// <param name="m"> /// The window message. /// </param> /// <returns> /// true if the message was handled; otherwise false. /// </returns> private bool OnNcHitTest(ref Message m) { const int HTRIGHT = 11, HTBOTTOM = 15, HTBOTTOMRIGHT = 17; var clientLocation = PointToClient(Cursor.Position); var gripBounds = new GripBounds(ClientRectangle); if (gripBounds.BottomRight.Contains(clientLocation)) { m.Result = (IntPtr)HTBOTTOMRIGHT; } else if (gripBounds.Bottom.Contains(clientLocation)) { m.Result = (IntPtr)HTBOTTOM; } else if (gripBounds.Right.Contains(clientLocation)) { m.Result = (IntPtr)HTRIGHT; } return(m.Result != IntPtr.Zero); }