void ScrollBar_Scroll(object sender, ScrollEventArgs e)
{
CalculateTabs();
int horizontal = hScrollBar.Visible ? hScrollBar.Height : 0;
int vertical = vScrollBar.Visible ? vScrollBar.Width : 0;
Rectangle rect = new Rectangle(border, (int)captionHeight, ClientSize.Width - vertical - 2 * border, ClientSize.Height - (int)captionHeight - horizontal - border);
Invalidate(rect);
}