private Rectangle GetTabRectangle(AutoHideTabFromBase tab)
 {
     return GetTabRectangle(tab, false);
 }
                private Rectangle GetTabRectangle(AutoHideTabFromBase tab, bool transformed)
                {
                    DockState dockState = tab.Content.DockHandler.DockState;
                    Rectangle rectTabStrip = GetLogicalTabStripRectangle(dockState);
                    if (rectTabStrip.IsEmpty)
                    {
                        return Rectangle.Empty;
                    }
                    int x = tab.TabX;
                    int y;

                    if (dockState == dockState.DockTopAutoHide || dockState == dockState.DockRightAutoHide)
                    {
                        y = rectTabStrip.Y;
                    }
                    else
                    {
                        y = rectTabStrip.Y + TabGapTop;
                    }

                    int width = (tab ).TabWidth;
                    int height = rectTabStrip.Height - TabGapTop;
                    if (! transformed)
                    {
                        return new Rectangle(x, y, width, height);
                    }
                    else
                    {
                        return GetTransformedRectangle(dockState, new Rectangle(x, y, width, height));
                    }
                }
                private void DrawTab(Graphics g, AutoHideTabFromBase tab)
                {
                    Rectangle rectTab = GetTabRectangle(tab);
                    if (rectTab.IsEmpty)
                    {
                        return;
                    }
                    DockState dockState = tab.Content.DockHandler.DockState;
                    IDockContent content = tab.Content;
                    BeginDrawTab();
                    Brush brushTabBackGround = this.BrushTabBackGround;
                    Pen penTabBorder = this.PenTabBorder;
                    Brush brushTabText = this.BrushTabText;

                    g.SmoothingMode = SmoothingMode.AntiAlias;
                    if (dockState == dockState.DockTopAutoHide || dockState == dockState.DockRightAutoHide)
                    {
                        DrawHelper.DrawTab(g, rectTab, Corners.Bottom, GradientType.Flat, Color.FromArgb(244, 242, 232), Color.FromArgb(244, 242, 232), Color.FromArgb(172, 168, 153), true);
                    }
                    else
                    {
                        DrawHelper.DrawTab(g, rectTab, Corners.Top, GradientType.Flat, Color.FromArgb(244, 242, 232), Color.FromArgb(244, 242, 232), Color.FromArgb(172, 168, 153), true);
                    }

                    // Set no rotate for drawing icon and text
                    Matrix matrixRotate = g.Transform;
                    g.Transform = MatrixIdentity;

                    // Draw the icon
                    Rectangle rectImage = rectTab;
                    rectImage.X += ImageGapLeft;
                    rectImage.Y += ImageGapTop;
                    int imageHeight = rectTab.Height - ImageGapTop - ImageGapBottom;
                    int imageWidth = this.ImageWidth;
                    if (imageHeight > this.ImageHeight)
                    {
                        imageWidth = this.ImageWidth * (imageHeight / this.ImageHeight);
                    }
                    rectImage.Height = imageHeight;
                    rectImage.Width = imageWidth;
                    rectImage = GetTransformedRectangle(dockState, rectImage);
                    g.DrawIcon(content.DockHandler.Icon, rectImage);

                    // Draw the text
                    if (content == content.DockHandler.Pane.ActiveContent)
                    {
                        Rectangle rectText = rectTab;
                        rectText.X += ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft;
                        rectText.Width -= ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft;
                        rectText = GetTransformedRectangle(dockState, rectText);
                        if (dockState == dockState.DockLeftAutoHide || dockState == dockState.DockRightAutoHide)
                        {
                            g.DrawString(content.DockHandler.TabText, Font, brushTabText, rectText, StringFormatTabVertical);
                        }
                        else
                        {
                            g.DrawString(content.DockHandler.TabText, Font, brushTabText, rectText, StringFormatTabHorizontal);
                        }
                    }
                    // Set rotate back
                    g.Transform = matrixRotate;
                    EndDrawTab();
                }