Exemple #1
0
        private void SizeScrollBars()
        {
            hScrollBar1.Minimum = 0;
            vScrollBar1.Minimum = 0;
            hScrollBar1.SetBounds(0, ClientRectangle.Height - hScrollBar1.Height, ClientRectangle.Width - vScrollBar1.Width, hScrollBar1.Height);
            vScrollBar1.SetBounds(ClientRectangle.Right - vScrollBar1.Width, 0, vScrollBar1.Width, ClientRectangle.Height - hScrollBar1.Height);

            if (TheImage != null)
            {
                hScrollBar1.Maximum = TheImage.Width + vScrollBar1.Width / 2 - ClientRectangle.Width;
                vScrollBar1.Maximum = TheImage.Height + hScrollBar1.Height / 2 - ClientRectangle.Height;
            }
            else
            {
                hScrollBar1.Maximum = 10;
                vScrollBar1.Maximum = 10;
            }

            Invalidate();
        }