ImageGlass.ImageBox.AdjustViewPort C# (CSharp) Method

AdjustViewPort() protected method

Adjusts the view port.
protected AdjustViewPort ( ) : void
return void
        protected virtual void AdjustViewPort()
        {
            Size viewSize;
            Size clientSize;
            int cw;
            int ch;
            bool vScroll;
            bool hScroll;

            viewSize = ViewSize;
            clientSize = ClientSize;

            if (!viewSize.IsEmpty)
            {
                Size size;

                size = GetInsideViewPort(true).Size;

                hScroll = ScaledImageWidth > size.Width;
                vScroll = ScaledImageHeight > size.Height;
            }
            else
            {
                hScroll = false;
                vScroll = false;
            }

            HScroll = hScroll;
            VScroll = vScroll;

            UpdateScrollbars();

            cw = vScroll ? clientSize.Width - _vScrollBar.Width : clientSize.Width;
            ch = hScroll ? clientSize.Height - _hScrollBar.Height : clientSize.Height;

            _hScrollBar.Width = cw;
            _hScrollBar.Top = clientSize.Height - _hScrollBar.Height;

            _vScrollBar.Height = ch;
            _vScrollBar.Left = clientSize.Width - _vScrollBar.Width;
        }
ImageBox