コード例 #1
0
        protected override void WndProc(ref Message message)
        {
            base.WndProc(ref message);

            if (message.Msg == 0x84)
            {
                var cp     = MousePosition;
                var cursor = this.PointToClient(cp);

                if (TopLeft.Contains(cursor))
                {
                    message.Result = (IntPtr)HTTOPLEFT;
                }
                else if (TopRight.Contains(cursor))
                {
                    message.Result = (IntPtr)HTTOPRIGHT;
                }
                else if (BottomLeft.Contains(cursor))
                {
                    message.Result = (IntPtr)HTBOTTOMLEFT;
                }
                else if (BottomRight.Contains(cursor))
                {
                    message.Result = (IntPtr)HTBOTTOMRIGHT;
                }

                else if (TopBorder.Contains(cursor))
                {
                    message.Result = (IntPtr)HTTOP;
                }
                else if (LeftBorder.Contains(cursor))
                {
                    message.Result = (IntPtr)HTLEFT;
                }
                else if (RightBorder.Contains(cursor))
                {
                    message.Result = (IntPtr)HTRIGHT;
                }
                else if (BottomBorder.Contains(cursor))
                {
                    message.Result = (IntPtr)HTBOTTOM;
                }
            }
        }