Exemple #1
0
        private void GetState(
            IntPtr scrollBarHWnd,
            bool bHorizontal,
            out ScrollBarHistTest histTest,
            out ControlState topLeftArrowState,
            out ControlState bottomRightArrowState,
            out ControlState thumbState)
        {
            histTest = ScrollBarHitTest(scrollBarHWnd);
            bool bLButtonDown = Helper.LeftKeyPressed();
            bool bEnabled     = _owner.Enabled;

            topLeftArrowState     = ControlState.Normal;
            bottomRightArrowState = ControlState.Normal;
            thumbState            = ControlState.Normal;

            switch (histTest)
            {
            case ScrollBarHistTest.LeftArrow:
            case ScrollBarHistTest.TopArrow:
                if (bEnabled)
                {
                    topLeftArrowState = bLButtonDown ?
                                        ControlState.Pressed : ControlState.Hover;
                }
                break;

            case ScrollBarHistTest.RightArrow:
            case ScrollBarHistTest.BottomArrow:
                if (bEnabled)
                {
                    bottomRightArrowState = bLButtonDown ?
                                            ControlState.Pressed : ControlState.Hover;
                }
                break;

            case ScrollBarHistTest.Thumb:
                if (bEnabled)
                {
                    thumbState = bLButtonDown ?
                                 ControlState.Pressed : ControlState.Hover;
                }
                break;
            }
        }
Exemple #2
0
        private void GetState(IntPtr scrollBarHWnd, bool bHorizontal, out ScrollBarHistTest histTest, out ControlState topLeftArrowState, out ControlState bottomRightArrowState, out ControlState thumbState)
        {
            histTest = this.ScrollBarHitTest(scrollBarHWnd);
            bool flag    = Win32.Helper.LeftKeyPressed();
            bool enabled = this._owner.Enabled;

            topLeftArrowState     = ControlState.Normal;
            bottomRightArrowState = ControlState.Normal;
            thumbState            = ControlState.Normal;
            switch (histTest)
            {
            case ScrollBarHistTest.TopArrow:
            case ScrollBarHistTest.LeftArrow:
                if (!enabled)
                {
                    break;
                }
                topLeftArrowState = flag ? ControlState.Pressed : ControlState.Hover;
                return;

            case ScrollBarHistTest.BottomArrow:
            case ScrollBarHistTest.RightArrow:
                if (!enabled)
                {
                    break;
                }
                bottomRightArrowState = flag ? ControlState.Pressed : ControlState.Hover;
                return;

            case ScrollBarHistTest.Thumb:
                if (enabled)
                {
                    thumbState = flag ? ControlState.Pressed : ControlState.Hover;
                }
                break;

            default:
                return;
            }
        }
Exemple #3
0
        protected override void WndProc(ref Message m)
        {
            try
            {
                switch (m.Msg)
                {
                case WM.WM_PAINT:
                    if (!_bPainting)
                    {
                        PAINTSTRUCT ps = new PAINTSTRUCT();

                        _bPainting = true;
                        NativeMethods.BeginPaint(m.HWnd, ref ps);
                        DrawScrollBar(m.HWnd, _maskControl.Handle);
                        NativeMethods.ValidateRect(m.HWnd, ref ps.rcPaint);
                        NativeMethods.EndPaint(m.HWnd, ref ps);
                        _bPainting = false;

                        m.Result = Result.TRUE;
                    }
                    else
                    {
                        base.WndProc(ref m);
                    }
                    break;

                case SBM.SBM_SETSCROLLINFO:
                    DrawScrollBar(m.HWnd, _maskControl.Handle, true, false);
                    base.WndProc(ref m);
                    break;

                case WM.WM_STYLECHANGED:
                    DrawScrollBar(m.HWnd, _maskControl.Handle, false, true);
                    base.WndProc(ref m);
                    break;

                case WM.WM_LBUTTONDOWN:
                    _lastMouseDownHistTest = ScrollBarHitTest(m.HWnd);
                    DrawScrollBar(m.HWnd, _maskControl.Handle);
                    base.WndProc(ref m);
                    break;

                case WM.WM_LBUTTONUP:
                case WM.WM_MOUSEMOVE:
                    DrawScrollBar(m.HWnd, _maskControl.Handle);
                    base.WndProc(ref m);
                    break;

                case WM.WM_MOUSELEAVE:
                    DrawScrollBar(m.HWnd, _maskControl.Handle);
                    base.WndProc(ref m);
                    break;

                case WM.WM_WINDOWPOSCHANGED:
                    WINDOWPOS pos = (WINDOWPOS)Marshal.PtrToStructure(
                        m.LParam, typeof(WINDOWPOS));
                    bool hide = (pos.flags & SWP.SWP_HIDEWINDOW) != 0;
                    bool show = (pos.flags & SWP.SWP_SHOWWINDOW) != 0;
                    if (hide)
                    {
                        _maskControl.SetVisibale(false);
                    }
                    else if (show)
                    {
                        _maskControl.SetVisibale(true);
                    }
                    _maskControl.CheckBounds(m.HWnd);
                    base.WndProc(ref m);
                    break;

                default:
                    base.WndProc(ref m);
                    break;
                }
            }
            catch
            {
            }
        }
        private void GetState(
            IntPtr scrollBarHWnd,
            bool bHorizontal,
            out ScrollBarHistTest histTest,
            out ControlState topLeftArrowState,
            out ControlState bottomRightArrowState,
            out ControlState thumbState)
        {
            histTest = ScrollBarHitTest(scrollBarHWnd);
            bool bLButtonDown = Helper.LeftKeyPressed();
            bool bEnabled = _owner.Enabled;

            topLeftArrowState = ControlState.Normal;
            bottomRightArrowState = ControlState.Normal;
            thumbState = ControlState.Normal;

            switch (histTest)
            {
                case ScrollBarHistTest.LeftArrow:
                case ScrollBarHistTest.TopArrow:
                    if (bEnabled)
                    {
                        topLeftArrowState = bLButtonDown ?
                            ControlState.Pressed : ControlState.Hover;
                    }
                    break;
                case ScrollBarHistTest.RightArrow:
                case ScrollBarHistTest.BottomArrow:
                    if (bEnabled)
                    {
                        bottomRightArrowState = bLButtonDown ?
                            ControlState.Pressed : ControlState.Hover;
                    }
                    break;
                case ScrollBarHistTest.Thumb:
                    if (bEnabled)
                    {
                        thumbState = bLButtonDown ?
                            ControlState.Pressed : ControlState.Hover;
                    }
                    break;
            }
        }
        protected override void WndProc(ref Message m)
        {
            try
            {
                switch (m.Msg)
                {
                    case WM.WM_PAINT:
                        if (!_bPainting)
                        {
                            PAINTSTRUCT ps = new PAINTSTRUCT();

                            _bPainting = true;
                            NativeMethods.BeginPaint(m.HWnd, ref ps);
                            DrawScrollBar(m.HWnd, _maskControl.Handle);
                            NativeMethods.ValidateRect(m.HWnd, ref ps.rcPaint);
                            NativeMethods.EndPaint(m.HWnd, ref ps);
                            _bPainting = false;

                            m.Result = Result.TRUE;
                        }
                        else
                        {
                            base.WndProc(ref m);
                        }
                        break;
                    case SBM.SBM_SETSCROLLINFO:
                        DrawScrollBar(m.HWnd, _maskControl.Handle, true, false);
                        base.WndProc(ref m);
                        break;
                    case WM.WM_STYLECHANGED:
                        DrawScrollBar(m.HWnd, _maskControl.Handle, false, true);
                        base.WndProc(ref m);
                        break;
                    case WM.WM_LBUTTONDOWN:
                        _lastMouseDownHistTest = ScrollBarHitTest(m.HWnd);
                        DrawScrollBar(m.HWnd, _maskControl.Handle);
                        base.WndProc(ref m);
                        break;
                    case WM.WM_LBUTTONUP:
                    case WM.WM_MOUSEMOVE:
                        DrawScrollBar(m.HWnd, _maskControl.Handle);
                        base.WndProc(ref m);
                        break;
                    case WM.WM_MOUSELEAVE:
                        DrawScrollBar(m.HWnd, _maskControl.Handle);
                        base.WndProc(ref m);
                        break;
                    case WM.WM_WINDOWPOSCHANGED:
                        WINDOWPOS pos = (WINDOWPOS)Marshal.PtrToStructure(
                            m.LParam, typeof(WINDOWPOS));
                        bool hide = (pos.flags & SWP.SWP_HIDEWINDOW) != 0;
                        bool show = (pos.flags & SWP.SWP_SHOWWINDOW) != 0;
                        if (hide)
                        {
                            _maskControl.SetVisibale(false);
                        }
                        else if (show)
                        {
                            _maskControl.SetVisibale(true);
                        }
                        _maskControl.CheckBounds(m.HWnd);
                        base.WndProc(ref m);
                        break;
                    default:
                        base.WndProc(ref m);
                        break;
                }
            }
            catch
            {
            }
        }
Exemple #6
0
        protected override void WndProc(ref Message m)
        {
            try
            {
                switch (m.Msg)
                {
                case 0x200:
                case 0x202:
                    this.DrawScrollBar(m.HWnd, this._maskControl.Handle);
                    base.WndProc(ref m);
                    return;

                case 0x201:
                    this._lastMouseDownHistTest = this.ScrollBarHitTest(m.HWnd);
                    this.DrawScrollBar(m.HWnd, this._maskControl.Handle);
                    base.WndProc(ref m);
                    return;

                case 0x2a3:
                    this.DrawScrollBar(m.HWnd, this._maskControl.Handle);
                    base.WndProc(ref m);
                    return;

                case 0xe9:
                    this.DrawScrollBar(m.HWnd, this._maskControl.Handle, true, false);
                    base.WndProc(ref m);
                    return;

                case 15:
                    if (!this._bPainting)
                    {
                        Win32.Struct.PAINTSTRUCT ps = new Win32.Struct.PAINTSTRUCT();
                        this._bPainting = true;
                        Win32.NativeMethods.BeginPaint(m.HWnd, ref ps);
                        this.DrawScrollBar(m.HWnd, this._maskControl.Handle);
                        Win32.NativeMethods.ValidateRect(m.HWnd, ref ps.rcPaint);
                        Win32.NativeMethods.EndPaint(m.HWnd, ref ps);
                        this._bPainting = false;
                        m.Result        = Win32.Result.TRUE;
                    }
                    else
                    {
                        base.WndProc(ref m);
                    }
                    return;

                case 0x47:
                {
                    Win32.Struct.WINDOWPOS windowpos = (Win32.Struct.WINDOWPOS)Marshal.PtrToStructure(m.LParam, typeof(Win32.Struct.WINDOWPOS));
                    bool flag  = (windowpos.flags & 0x80L) != 0L;
                    bool flag2 = (windowpos.flags & 0x40L) != 0L;
                    if (flag)
                    {
                        this._maskControl.SetVisibale(false);
                    }
                    else if (flag2)
                    {
                        this._maskControl.SetVisibale(true);
                    }
                    this._maskControl.CheckBounds(m.HWnd);
                    base.WndProc(ref m);
                    return;
                }

                case 0x7d:
                    this.DrawScrollBar(m.HWnd, this._maskControl.Handle, false, true);
                    base.WndProc(ref m);
                    return;
                }
                base.WndProc(ref m);
            }
            catch
            {
            }
        }
        protected override void WndProc(ref Message m)
        {
            try
            {
                switch (m.Msg)
                {
                    case 0x200:
                    case 0x202:
                        this.DrawScrollBar(m.HWnd, this._maskControl.Handle);
                        base.WndProc(ref m);
                        return;

                    case 0x201:
                        this._lastMouseDownHistTest = this.ScrollBarHitTest(m.HWnd);
                        this.DrawScrollBar(m.HWnd, this._maskControl.Handle);
                        base.WndProc(ref m);
                        return;

                    case 0x2a3:
                        this.DrawScrollBar(m.HWnd, this._maskControl.Handle);
                        base.WndProc(ref m);
                        return;

                    case 0xe9:
                        this.DrawScrollBar(m.HWnd, this._maskControl.Handle, true, false);
                        base.WndProc(ref m);
                        return;

                    case 15:
                        if (!this._bPainting)
                        {
                            Win32.Struct.PAINTSTRUCT ps = new Win32.Struct.PAINTSTRUCT();
                            this._bPainting = true;
                            Win32.NativeMethods.BeginPaint(m.HWnd, ref ps);
                            this.DrawScrollBar(m.HWnd, this._maskControl.Handle);
                            Win32.NativeMethods.ValidateRect(m.HWnd, ref ps.rcPaint);
                            Win32.NativeMethods.EndPaint(m.HWnd, ref ps);
                            this._bPainting = false;
                            m.Result = Win32. Result.TRUE;
                        }
                        else
                        {
                            base.WndProc(ref m);
                        }
                        return;

                    case 0x47:
                    {
                        Win32.Struct.WINDOWPOS windowpos = (Win32.Struct.WINDOWPOS) Marshal.PtrToStructure(m.LParam, typeof(Win32.Struct.WINDOWPOS));
                        bool flag = (windowpos.flags & 0x80L) != 0L;
                        bool flag2 = (windowpos.flags & 0x40L) != 0L;
                        if (flag)
                        {
                            this._maskControl.SetVisibale(false);
                        }
                        else if (flag2)
                        {
                            this._maskControl.SetVisibale(true);
                        }
                        this._maskControl.CheckBounds(m.HWnd);
                        base.WndProc(ref m);
                        return;
                    }
                    case 0x7d:
                        this.DrawScrollBar(m.HWnd, this._maskControl.Handle, false, true);
                        base.WndProc(ref m);
                        return;
                }
                base.WndProc(ref m);
            }
            catch
            {
            }
        }
        private void GetState(IntPtr scrollBarHWnd, bool bHorizontal, out ScrollBarHistTest histTest, out ControlState topLeftArrowState, out ControlState bottomRightArrowState, out ControlState thumbState)
        {
            histTest = this.ScrollBarHitTest(scrollBarHWnd);
            bool flag = Win32. Helper.LeftKeyPressed();
            bool enabled = this._owner.Enabled;
            topLeftArrowState = ControlState.Normal;
            bottomRightArrowState = ControlState.Normal;
            thumbState = ControlState.Normal;
            switch (histTest)
            {
                case ScrollBarHistTest.TopArrow:
                case ScrollBarHistTest.LeftArrow:
                    if (!enabled)
                    {
                        break;
                    }
                    topLeftArrowState = flag ? ControlState.Pressed : ControlState.Hover;
                    return;

                case ScrollBarHistTest.BottomArrow:
                case ScrollBarHistTest.RightArrow:
                    if (!enabled)
                    {
                        break;
                    }
                    bottomRightArrowState = flag ? ControlState.Pressed : ControlState.Hover;
                    return;

                case ScrollBarHistTest.Thumb:
                    if (enabled)
                    {
                        thumbState = flag ? ControlState.Pressed : ControlState.Hover;
                    }
                    break;

                default:
                    return;
            }
        }