예제 #1
0
 private void FrameChanged()
 {
     SBNFormController.RECT rECT = default(SBNFormController.RECT);
     SBNFormController.GetWindowRect(this.CurrentForm.Handle, ref rECT);
     SBNFormController.SetWindowPos(this.CurrentForm.Handle, IntPtr.Zero, rECT.Left, rECT.Top, rECT.Right - rECT.Left, rECT.Bottom - rECT.Top, 32u);
 }
예제 #2
0
        private SBNFormController.HIT_CONSTANTS HitTest()
        {
            SBNFormController.RECT rECT = default(SBNFormController.RECT);
            Point pt = default(Point);

            SBNFormController.GetCursorPos(ref pt);
            SBNFormController.GetWindowRect(this.CurrentForm.Handle, ref rECT);
            pt.X -= rECT.Left;
            pt.Y -= rECT.Top;
            int num  = rECT.Right - rECT.Left;
            int num2 = rECT.Bottom - rECT.Top;

            SBNFormController.RECT          rECT2 = new SBNFormController.RECT(0, 0, this.FrameWidth, this.FrameHeight);
            SBNFormController.HIT_CONSTANTS result;
            if (SBNFormController.PtInRect(ref rECT2, pt))
            {
                result = SBNFormController.HIT_CONSTANTS.HTTOPLEFT;
            }
            else
            {
                rECT2 = new SBNFormController.RECT(num - this.FrameWidth, 0, num, this.FrameHeight);
                if (SBNFormController.PtInRect(ref rECT2, pt))
                {
                    result = SBNFormController.HIT_CONSTANTS.HTTOPRIGHT;
                }
                else
                {
                    rECT2 = new SBNFormController.RECT(this.FrameWidth, 0, num - this.FrameWidth * 2 - this._iFrameOffset, this.FrameHeight);
                    if (SBNFormController.PtInRect(ref rECT2, pt))
                    {
                        result = SBNFormController.HIT_CONSTANTS.HTTOP;
                    }
                    else
                    {
                        rECT2 = new SBNFormController.RECT(this.FrameWidth, this.FrameHeight, num - (this.FrameWidth * 2 + this._iFrameOffset), this._tMargins.cyTopHeight);
                        if (SBNFormController.PtInRect(ref rECT2, pt))
                        {
                            result = SBNFormController.HIT_CONSTANTS.HTCAPTION;
                        }
                        else
                        {
                            rECT2 = new SBNFormController.RECT(0, this.FrameHeight, this.FrameWidth, num2 - this.FrameHeight);
                            if (SBNFormController.PtInRect(ref rECT2, pt))
                            {
                                result = SBNFormController.HIT_CONSTANTS.HTLEFT;
                            }
                            else
                            {
                                rECT2 = new SBNFormController.RECT(0, num2 - this.FrameHeight, this.FrameWidth, num2);
                                if (SBNFormController.PtInRect(ref rECT2, pt))
                                {
                                    result = SBNFormController.HIT_CONSTANTS.HTBOTTOMLEFT;
                                }
                                else
                                {
                                    rECT2 = new SBNFormController.RECT(this.FrameWidth, num2 - this.FrameHeight, num - this.FrameWidth, num2);
                                    if (SBNFormController.PtInRect(ref rECT2, pt))
                                    {
                                        result = SBNFormController.HIT_CONSTANTS.HTBOTTOM;
                                    }
                                    else
                                    {
                                        rECT2 = new SBNFormController.RECT(num - this.FrameWidth, num2 - this.FrameHeight, num, num2);
                                        if (SBNFormController.PtInRect(ref rECT2, pt))
                                        {
                                            result = SBNFormController.HIT_CONSTANTS.HTBOTTOMRIGHT;
                                        }
                                        else
                                        {
                                            rECT2 = new SBNFormController.RECT(num - this.FrameWidth, this.FrameHeight, num, num2 - this.FrameHeight);
                                            if (SBNFormController.PtInRect(ref rECT2, pt))
                                            {
                                                result = SBNFormController.HIT_CONSTANTS.HTRIGHT;
                                            }
                                            else
                                            {
                                                result = SBNFormController.HIT_CONSTANTS.HTCLIENT;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(result);
        }