public int GetTabRow(int index)
{
// All calculations will use this rect as the base point
// because the itemsize does not return the correct width.
Rectangle rect = this.GetTabRect(index);
int row = -1;
switch (this.Alignment) {
case TabAlignment.Top:
row = (rect.Y - 2)/rect.Height;
break;
case TabAlignment.Bottom:
row = ((this.Height - rect.Y - 2)/rect.Height) - 1;
break;
case TabAlignment.Left:
row = (rect.X - 2)/rect.Width;
break;
case TabAlignment.Right:
row = ((this.Width - rect.X - 2)/rect.Width) - 1;
break;
}
return row;
}