Beispiel #1
0
 protected virtual void ProcessMouseMove(Point p)
 {
     CloseBoxState = EnumControlState.Default;
     MaxBoxState   = EnumControlState.Default;
     MinBoxState   = EnumControlState.Default;
     if (CloseBoxRect.Contains(p))
     {
         CloseBoxState = EnumControlState.HeightLight;
     }
     if (MinimizeBoxRect.Contains(p))
     {
         MinBoxState = EnumControlState.HeightLight;
     }
     if (MaximizeBoxRect.Contains(p))
     {
         MaxBoxState = EnumControlState.HeightLight;
     }
     Invalidate(CaptionRect);
 }
Beispiel #2
0
        protected virtual void WmNcHitTest(ref Message m)
        {
            int   value = m.LParam.ToInt32();
            Point p     = new Point(Win32.LOWORD(value), Win32.HIWORD(value));

            p = PointToClient(p);
            if (LogoRect.Contains(p))
            {
                m.Result = new IntPtr(3);
            }
            else
            {
                if (_ResizeEnable && _CaptionHeight > 0)
                {
                    int num = 4;
                    if (p.X <= num && p.Y <= num)
                    {
                        m.Result = new IntPtr(13);
                        return;
                    }
                    if (p.X >= base.Width - num && p.Y <= num)
                    {
                        m.Result = new IntPtr(14);
                        return;
                    }
                    if (p.X >= base.Width - num && p.Y >= base.Height - num)
                    {
                        m.Result = new IntPtr(17);
                        return;
                    }
                    if (p.X <= num && p.Y >= base.Height - num)
                    {
                        m.Result = new IntPtr(16);
                        return;
                    }
                    if (p.Y <= num)
                    {
                        m.Result = new IntPtr(12);
                        return;
                    }
                    if (p.Y >= base.Height - num)
                    {
                        m.Result = new IntPtr(15);
                        return;
                    }
                    if (p.X <= num)
                    {
                        m.Result = new IntPtr(10);
                        return;
                    }
                    if (p.X >= base.Width - num)
                    {
                        m.Result = new IntPtr(11);
                        return;
                    }
                }
                if (p.Y <= _CaptionHeight)
                {
                    if (!CloseBoxRect.Contains(p) && !MaximizeBoxRect.Contains(p) && !MinimizeBoxRect.Contains(p))
                    {
                        m.Result = new IntPtr(2);
                    }
                    else
                    {
                        m.Result = new IntPtr(1);
                    }
                }
                else if (_CaptionHeight > 0)
                {
                    m.Result = new IntPtr(2);
                }
            }
        }
Beispiel #3
0
        private bool WmNcHitTest(ref Message m)
        {
            int   para = m.LParam.ToInt32();
            int   x0   = WinAPI.LOWORD(para);
            int   y0   = WinAPI.HIWORD(para);
            Point p    = PointToClient(new Point(x0, y0));

            if (Resizable)
            {
                if (TopLeftRect.Contains(p))
                {
                    m.Result = new IntPtr((int)WinAPI.NCHITTEST.HTTOPLEFT);
                    return(true);
                }

                if (TopRect.Contains(p))
                {
                    m.Result = new IntPtr((int)WinAPI.NCHITTEST.HTTOP);
                    return(true);
                }

                if (TopRightRect.Contains(p))
                {
                    m.Result = new IntPtr((int)WinAPI.NCHITTEST.HTTOPRIGHT);
                    return(true);
                }

                if (LeftRect.Contains(p))
                {
                    m.Result = new IntPtr((int)WinAPI.NCHITTEST.HTLEFT);
                    return(true);
                }

                if (RightRect.Contains(p))
                {
                    m.Result = new IntPtr((int)WinAPI.NCHITTEST.HTRIGHT);
                    return(true);
                }

                if (BottomLeftRect.Contains(p))
                {
                    m.Result = new IntPtr((int)WinAPI.NCHITTEST.HTBOTTOMLEFT);
                    return(true);
                }

                if (BottomRect.Contains(p))
                {
                    m.Result = new IntPtr((int)WinAPI.NCHITTEST.HTBOTTOM);
                    return(true);
                }

                if (BottomRightRect.Contains(p))
                {
                    m.Result = new IntPtr((int)WinAPI.NCHITTEST.HTBOTTOMRIGHT);
                    return(true);
                }
            }

            if (IconRect.Contains(p))
            {
                m.Result = new IntPtr((int)WinAPI.NCHITTEST.HTSYSMENU);
                return(true);
            }

            if (CloseBoxRect.Contains(p) || MaxBoxRect.Contains(p) || MinBoxRect.Contains(p))
            {
                m.Result = new IntPtr((int)WinAPI.NCHITTEST.HTCLIENT);
                return(true);
            }

            if (IsMdiContainer && _mdiBarController != null)
            {
                if (_mdiBarController.HitTestBounds.Contains(p))
                {
                    m.Result = new IntPtr((int)WinAPI.NCHITTEST.HTCLIENT);
                    return(true);
                }
            }

            if (CaptionRect.Contains(p))
            {
                m.Result = new IntPtr((int)WinAPI.NCHITTEST.HTCAPTION);
                return(true);
            }

            m.Result = new IntPtr((int)WinAPI.NCHITTEST.HTCLIENT);
            return(true);
        }