private void DoResize()
{
if (Visible && Width > 0 && Height > 0 &&
IsHandleCreated)
{
try
{
if (Filler == null)
return;
TopThumb.Width = SystemInformation.VerticalScrollBarWidth;
LeftThumb.Height = SystemInformation.HorizontalScrollBarHeight;
vScroll.Width = SystemInformation.VerticalScrollBarWidth;
hScroll.Height = SystemInformation.HorizontalScrollBarHeight;
if (TopThumbVisible)
{
vScroll.Top = TopThumb.Height;
if (hScroll.Visible)
vScroll.Height = ClientHeight - hScroll.Height -
TopThumb.Height;
else
vScroll.Height = ClientHeight - TopThumb.Height;
}
else
{
if (hScroll.Visible)
vScroll.Height = ClientHeight - hScroll.Height;
else
vScroll.Height = ClientHeight;
vScroll.Top = 0;
}
if (LeftThumbVisible)
{
hScroll.Left = LeftThumb.Width;
if (vScroll.Visible)
hScroll.Width = ClientWidth - vScroll.Width -
LeftThumb.Width;
else
hScroll.Width = ClientWidth - LeftThumb.Width;
}
else
{
if (vScroll.Visible)
hScroll.Width = ClientWidth - vScroll.Width;
else
hScroll.Width = ClientWidth;
hScroll.Left = 0;
}
if (Width != OldWidth && Width > 0)
{
OldWidth = Width;
if (Painter != null)
Painter.Resize();
}
vScroll.Left = ClientWidth - vScroll.Width;
hScroll.Top = ClientHeight - hScroll.Height;
LeftThumb.Left = 0;
LeftThumb.Top = hScroll.Top;
TopThumb.Left = vScroll.Left;
TopThumb.Top = 0;
Filler.Left = vScroll.Left;
Filler.Top = hScroll.Top;
Filler.Width = vScroll.Width;
Filler.Height = hScroll.Height;
}
catch {}
}
}