// Request to scroll horizontally and vertically by the specified scrolling amount
        void IScrollProvider.Scroll(ScrollAmount HorizontalAmount, ScrollAmount VerticalAmount)
        {
            // Make sure that the control is enabled
            if (!SafeNativeMethods.IsWindowEnabled(_hwnd))
            {
                throw new ElementNotEnabledException();
            }

            if (!IsScrollable())
            {
                throw new InvalidOperationException(SR.Get(SRID.OperationCannotBePerformed));
            }

            bool fHorizontal = IsHorizontal(_hwnd);

            if ((fHorizontal && VerticalAmount != ScrollAmount.NoAmount) || (!fHorizontal && HorizontalAmount != ScrollAmount.NoAmount))
            {
                throw new InvalidOperationException(SR.Get(SRID.OperationCannotBePerformed));
            }

            // Fake the scroll with pushes on the buttons
            // It is risky to do a setpos since the calculation of the amount in pels to scroll
            // is dependent on the buttons being visible or not.
            switch (fHorizontal ? HorizontalAmount : VerticalAmount)
            {
            case ScrollAmount.LargeDecrement:
            case ScrollAmount.SmallDecrement:
                if (IsVisible(_hwnd, NativeMethods.PGB_TOPORLEFT))
                {
                    PagerButton pagerButton = new PagerButton(_hwnd, this, PagerItem.PrevBtn);
                    ((IInvokeProvider)pagerButton).Invoke();
                    return;
                }
                throw new InvalidOperationException(SR.Get(SRID.OperationCannotBePerformed));

            case ScrollAmount.LargeIncrement:
            case ScrollAmount.SmallIncrement:
                if (IsVisible(_hwnd, NativeMethods.PGB_BOTTOMORRIGHT))
                {
                    PagerButton pagerButton = new PagerButton(_hwnd, this, PagerItem.NextBtn);
                    ((IInvokeProvider)pagerButton).Invoke();
                    return;
                }
                throw new InvalidOperationException(SR.Get(SRID.OperationCannotBePerformed));

            default:
                throw new InvalidOperationException(SR.Get(SRID.OperationCannotBePerformed));
            }
        }
        // Returns a Proxy element corresponding to the specified screen coordinates.
        internal override ProxySimple ElementProviderFromPoint(int x, int y)
        {
            // prev button
            if (IsVisible(_hwnd, NativeMethods.PGB_TOPORLEFT))
            {
                NativeMethods.Win32Rect rc = PagerButton.BoundingRect(_hwnd, PagerItem.PrevBtn);
                if (Misc.PtInRect(ref rc, x, y))
                {
                    return(new PagerButton(_hwnd, this, PagerItem.PrevBtn));
                }
            }

            // Next button
            if (IsVisible(_hwnd, NativeMethods.PGB_BOTTOMORRIGHT))
            {
                NativeMethods.Win32Rect rc = PagerButton.BoundingRect(_hwnd, PagerItem.NextBtn);
                if (Misc.PtInRect(ref rc, x, y))
                {
                    return(new PagerButton(_hwnd, this, PagerItem.NextBtn));
                }
            }

            return(null);
        }