System.Windows.Forms.CustomTabControl.DrawTabImage C# (CSharp) Method

DrawTabImage() private method

private DrawTabImage ( int index, Graphics graphics ) : void
index int
graphics System.Drawing.Graphics
return void
        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);
                }
            }
        }