Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
                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);
                }