internal void DrawTab( Graphics g, TabPage tabPage, int nIndex )
{
Rectangle recBounds = GetTabRect( nIndex );
RectangleF tabTextArea = GetTabRect( nIndex );
bool hasErrors = CheckForErrors( tabPage.Controls );
bool isSelected = ( SelectedIndex == nIndex );
var pt = GetPolyPoints( recBounds );
//-------------------------------------------//
//--- fill this tab with background color ---//
//-------------------------------------------//
Color tabBackColor = (hasErrors ? GetErrorColor( isSelected ) :
isSelected ? tabPage.BackColor : UTRSGraphicsUtils.DarkenColor( tabPage.BackColor, 10 )
);
DrawTabBackground( g, tabBackColor, pt );
DrawTabBorder( g, tabPage, pt, isSelected, ref recBounds );
DrawTabIcon( g, tabPage, nIndex, ref recBounds, ref tabTextArea, hasErrors );
DrawTabText( g, tabPage, ref tabTextArea, hasErrors );
}