Beispiel #1
0
        private bool OnNcHitTest(ref Message m, bool contentControl)
        {
            int x = NativeUtility.LOWORD(m.LParam);
            int y = NativeUtility.HIWORD(m.LParam);

            var    clientLocation = PointToClient(new Point(x, y));
            var    gripBounds     = new GripBounds(contentControl ? Content.ClientRectangle : ClientRectangle);
            IntPtr transparent    = new IntPtr(Constants.HTTRANSPARENT);

            if (_resizableTop)
            {
                if (_resizableLeft && gripBounds.TopLeft.Contains(clientLocation))
                {
                    m.Result = contentControl ? transparent : (IntPtr)Constants.HTTOPLEFT;
                    return(true);
                }
                if (!_resizableLeft && gripBounds.TopRight.Contains(clientLocation))
                {
                    m.Result = contentControl ? transparent : (IntPtr)Constants.HTTOPRIGHT;
                    return(true);
                }
                if (gripBounds.Top.Contains(clientLocation))
                {
                    m.Result = contentControl ? transparent : (IntPtr)Constants.HTTOP;
                    return(true);
                }
            }
            else
            {
                if (_resizableLeft && gripBounds.BottomLeft.Contains(clientLocation))
                {
                    m.Result = contentControl ? transparent : (IntPtr)Constants.HTBOTTOMLEFT;
                    return(true);
                }
                if (!_resizableLeft && gripBounds.BottomRight.Contains(clientLocation))
                {
                    m.Result = contentControl ? transparent : (IntPtr)Constants.HTBOTTOMRIGHT;
                    return(true);
                }
                if (gripBounds.Bottom.Contains(clientLocation))
                {
                    m.Result = contentControl ? transparent : (IntPtr)Constants.HTBOTTOM;
                    return(true);
                }
            }
            if (_resizableLeft && gripBounds.Left.Contains(clientLocation))
            {
                m.Result = contentControl ? transparent : (IntPtr)Constants.HTLEFT;
                return(true);
            }
            if (!_resizableLeft && gripBounds.Right.Contains(clientLocation))
            {
                m.Result = contentControl ? transparent : (IntPtr)Constants.HTRIGHT;
                return(true);
            }
            return(false);
        }
Beispiel #2
0
        private bool OnNcHitTest(ref Message m)
        {
            int x = NativeUtility.LOWORD(m.LParam);
            int y = NativeUtility.HIWORD(m.LParam);

            var point = PointToClient(new Point(x, y));
            var rc = ClientRectangle;
            bool isMaximized = WindowState == FormWindowState.Maximized;

            if(_isInMulticontrolMode)
            {
                if(isMaximized)
                {
                    if((new Rectangle(
                        rc.X, rc.Y,
                        rc.Width, Renderer.FloatTitleHeight)).Contains(point))
                    {
                        m.Result = (IntPtr)Constants.HTCAPTION;
                        return true;
                    }
                }
                else
                {
                    if((new Rectangle(
                        rc.X + Renderer.FloatBorderSize,
                        rc.Y + Renderer.FloatBorderSize,
                        rc.Width - Renderer.FloatBorderSize * 2,
                        Renderer.FloatTitleHeight)).Contains(point))
                    {
                        m.Result = (IntPtr)Constants.HTCAPTION;
                        return true;
                    }
                }
            }

            if(isMaximized) return false;

            var grip = new GripBounds(rc);
            if(grip.TopLeft.Contains(point))
            {
                m.Result = (IntPtr)Constants.HTTOPLEFT;
                return true;
            }
            if(grip.TopRight.Contains(point))
            {
                m.Result = (IntPtr)Constants.HTTOPRIGHT;
                return true;
            }
            if(grip.Top.Contains(point))
            {
                m.Result = (IntPtr)Constants.HTTOP;
                return true;
            }
            if(grip.BottomLeft.Contains(point))
            {
                m.Result = (IntPtr)Constants.HTBOTTOMLEFT;
                return true;
            }
            if(grip.BottomRight.Contains(point))
            {
                m.Result = (IntPtr)Constants.HTBOTTOMRIGHT;
                return true;
            }
            if(grip.Bottom.Contains(point))
            {
                m.Result = (IntPtr)Constants.HTBOTTOM;
                return true;
            }
            if(grip.Left.Contains(point))
            {
                m.Result = (IntPtr)Constants.HTLEFT;
                return true;
            }
            if(grip.Right.Contains(point))
            {
                m.Result = (IntPtr)Constants.HTRIGHT;
                return true;
            }
            return false;
        }
Beispiel #3
0
        private bool OnNcHitTest(ref Message m, bool contentControl)
        {
            int x = NativeUtility.LOWORD(m.LParam);
            int y = NativeUtility.HIWORD(m.LParam);

            var clientLocation = PointToClient(new Point(x, y));
            var gripBounds = new GripBounds(contentControl ? _content.ClientRectangle : ClientRectangle);
            IntPtr transparent = new IntPtr(Constants.HTTRANSPARENT);

            if(_resizableTop)
            {
                if(_resizableLeft && gripBounds.TopLeft.Contains(clientLocation))
                {
                    m.Result = contentControl ? transparent : (IntPtr)Constants.HTTOPLEFT;
                    return true;
                }
                if(!_resizableLeft && gripBounds.TopRight.Contains(clientLocation))
                {
                    m.Result = contentControl ? transparent : (IntPtr)Constants.HTTOPRIGHT;
                    return true;
                }
                if(gripBounds.Top.Contains(clientLocation))
                {
                    m.Result = contentControl ? transparent : (IntPtr)Constants.HTTOP;
                    return true;
                }
            }
            else
            {
                if(_resizableLeft && gripBounds.BottomLeft.Contains(clientLocation))
                {
                    m.Result = contentControl ? transparent : (IntPtr)Constants.HTBOTTOMLEFT;
                    return true;
                }
                if(!_resizableLeft && gripBounds.BottomRight.Contains(clientLocation))
                {
                    m.Result = contentControl ? transparent : (IntPtr)Constants.HTBOTTOMRIGHT;
                    return true;
                }
                if(gripBounds.Bottom.Contains(clientLocation))
                {
                    m.Result = contentControl ? transparent : (IntPtr)Constants.HTBOTTOM;
                    return true;
                }
            }
            if(_resizableLeft && gripBounds.Left.Contains(clientLocation))
            {
                m.Result = contentControl ? transparent : (IntPtr)Constants.HTLEFT;
                return true;
            }
            if(!_resizableLeft && gripBounds.Right.Contains(clientLocation))
            {
                m.Result = contentControl ? transparent : (IntPtr)Constants.HTRIGHT;
                return true;
            }
            return false;
        }
Beispiel #4
0
        private bool OnNcHitTest(ref Message m)
        {
            int x = NativeUtility.LOWORD(m.LParam);
            int y = NativeUtility.HIWORD(m.LParam);

            var  point       = PointToClient(new Point(x, y));
            var  rc          = ClientRectangle;
            bool isMaximized = WindowState == FormWindowState.Maximized;

            if (_isInMulticontrolMode)
            {
                if (isMaximized)
                {
                    if ((new Rectangle(
                             rc.X, rc.Y,
                             rc.Width, Renderer.FloatTitleHeight)).Contains(point))
                    {
                        m.Result = (IntPtr)Constants.HTCAPTION;
                        return(true);
                    }
                }
                else
                {
                    if ((new Rectangle(
                             rc.X + Renderer.FloatBorderSize,
                             rc.Y + Renderer.FloatBorderSize,
                             rc.Width - Renderer.FloatBorderSize * 2,
                             Renderer.FloatTitleHeight)).Contains(point))
                    {
                        m.Result = (IntPtr)Constants.HTCAPTION;
                        return(true);
                    }
                }
            }

            if (isMaximized)
            {
                return(false);
            }

            var grip = new GripBounds(rc);

            if (grip.TopLeft.Contains(point))
            {
                m.Result = (IntPtr)Constants.HTTOPLEFT;
                return(true);
            }
            if (grip.TopRight.Contains(point))
            {
                m.Result = (IntPtr)Constants.HTTOPRIGHT;
                return(true);
            }
            if (grip.Top.Contains(point))
            {
                m.Result = (IntPtr)Constants.HTTOP;
                return(true);
            }
            if (grip.BottomLeft.Contains(point))
            {
                m.Result = (IntPtr)Constants.HTBOTTOMLEFT;
                return(true);
            }
            if (grip.BottomRight.Contains(point))
            {
                m.Result = (IntPtr)Constants.HTBOTTOMRIGHT;
                return(true);
            }
            if (grip.Bottom.Contains(point))
            {
                m.Result = (IntPtr)Constants.HTBOTTOM;
                return(true);
            }
            if (grip.Left.Contains(point))
            {
                m.Result = (IntPtr)Constants.HTLEFT;
                return(true);
            }
            if (grip.Right.Contains(point))
            {
                m.Result = (IntPtr)Constants.HTRIGHT;
                return(true);
            }
            return(false);
        }