private void DrawTabImage(int index, Graphics graphics)
{
Image tabImage = null;
if (this.TabPages[index].ImageIndex > -1 && this.ImageList != null && this.ImageList.Images.Count > this.TabPages[index].ImageIndex){
tabImage = this.ImageList.Images[this.TabPages[index].ImageIndex];
} else if ((!string.IsNullOrEmpty(this.TabPages[index].ImageKey) && !this.TabPages[index].ImageKey.Equals("(none)", StringComparison.OrdinalIgnoreCase))
&& this.ImageList != null && this.ImageList.Images.ContainsKey(this.TabPages[index].ImageKey)) {
tabImage = this.ImageList.Images[this.TabPages[index].ImageKey];
}
if (tabImage != null) {
if (this.RightToLeftLayout){
tabImage.RotateFlip(RotateFlipType.RotateNoneFlipX);
}
Rectangle imageRect = this.GetTabImageRect(index);
if (this.TabPages[index].Enabled){
graphics.DrawImage(tabImage, imageRect);
} else {
ControlPaint.DrawImageDisabled(graphics, tabImage, imageRect.X, imageRect.Y, Color.Transparent);
}
}
}