public virtual Rectangle GetTabRect(int index)
{
if (index < 0)
{
return(new Rectangle());
}
Rectangle tabBounds = _TabControl.GetTabRect(index);
if (_TabControl.RightToLeftLayout)
{
tabBounds.X = _TabControl.Width - tabBounds.Right;
}
bool firstTabinRow = _TabControl.IsFirstTabInRow(index);
// Expand to overlap the tabPage
switch (_TabControl.Alignment)
{
case TabAlignment.Top:
tabBounds.Height += 2;
break;
case TabAlignment.Bottom:
tabBounds.Height += 2;
tabBounds.Y -= 2;
break;
case TabAlignment.Left:
tabBounds.Width += 2;
break;
case TabAlignment.Right:
tabBounds.X -= 2;
tabBounds.Width += 2;
break;
}
// Create Overlap unless first tab in the row to align with tabPage
if ((!firstTabinRow || _TabControl.RightToLeftLayout) && _Overlap > 0)
{
if (_TabControl.Alignment <= TabAlignment.Bottom)
{
tabBounds.X -= _Overlap;
tabBounds.Width += _Overlap;
}
else
{
tabBounds.Y -= _Overlap;
tabBounds.Height += _Overlap;
}
}
// Adjust first tab in the row to align with tabPage
EnsureFirstTabIsInView(ref tabBounds, index);
return(tabBounds);
}