private void InitScrollbars()
{
if (vScroll == null || hScroll == null)
return;
if (ScrollBars == ScrollBars.Both)
{
vScroll.Left = ClientWidth - vScroll.Width;
vScroll.Top = 0;
vScroll.Height = ClientHeight - hScroll.Height;
hScroll.Left = 0;
hScroll.Top = ClientHeight - hScroll.Height;
hScroll.Width = ClientWidth - vScroll.Width;
Filler.Left = vScroll.Left;
Filler.Top = hScroll.Top;
Filler.Visible = true;
vScroll.Visible = true;
hScroll.Visible = true;
}
else if (ScrollBars == ScrollBars.Vertical)
{
vScroll.Left = ClientWidth - vScroll.Width;
vScroll.Top = 0;
vScroll.Height = ClientHeight;
hScroll.Left = 0;
hScroll.Top = ClientHeight - hScroll.Height;
hScroll.Width = ClientWidth - vScroll.Width;
Filler.Left = vScroll.Left;
Filler.Top = hScroll.Top;
Filler.Visible = false;
vScroll.Visible = true;
hScroll.Visible = false;
}
else if (ScrollBars == ScrollBars.Horizontal)
{
vScroll.Left = ClientWidth - vScroll.Width;
vScroll.Top = 0;
vScroll.Height = ClientHeight;
hScroll.Left = 0;
hScroll.Top = ClientHeight - hScroll.Height;
hScroll.Width = ClientWidth;
Filler.Left = vScroll.Left;
Filler.Top = hScroll.Top;
Filler.Visible = false;
vScroll.Visible = false;
hScroll.Visible = true;
}
else if (ScrollBars == ScrollBars.None)
{
vScroll.Left = ClientWidth - vScroll.Width;
vScroll.Top = 0;
vScroll.Height = ClientHeight;
hScroll.Left = 0;
hScroll.Top = ClientHeight - hScroll.Height;
hScroll.Width = ClientWidth;
Filler.Left = vScroll.Left;
Filler.Top = hScroll.Top;
Filler.Visible = false;
vScroll.Visible = false;
hScroll.Visible = false;
}
}