Exemple #1
0
        private void DrawTab_Document(Graphics g, IDockContent content, Rectangle rect, int index)
        {
            Rectangle rectText = rect;

            rectText.X     += DocumentTextExtraWidth / 2;
            rectText.Width -= DocumentTextExtraWidth;
            rectText.X     += _DocumentTabOverlap;

            if (index == 0)
            {
                rect.Width += _DocumentTabOverlap;
            }
            else
            {
                rect.X += _DocumentTabOverlap;
            }

            g.SmoothingMode = SmoothingMode.AntiAlias;
            if (object.ReferenceEquals(DockPane.ActiveContent, content))
            {
                if (index == 0)
                {
                    if (DockPane.DockPanel.ShowDocumentIcon)
                    {
                        rectText.X     += DocumentIconGapLeft;
                        rectText.Width -= DocumentIconGapLeft;
                    }
                }
                else
                {
                    rect.X     -= _DocumentTabOverlap;
                    rect.Width += _DocumentTabOverlap;
                    if (DockPane.DockPanel.ShowDocumentIcon)
                    {
                        rectText.X     += DocumentIconGapLeft;
                        rectText.Width -= DocumentIconGapLeft;
                    }
                }

                // Draw Tab & Text
                DrawHelper.DrawDocumentTab(g, rect, Color.White, Color.White, Color.FromArgb(127, 157, 185), BaseControls.Docking.DrawHelper.TabDrawType.Active, true);
                if (DockPane.IsActiveDocumentPane)
                {
                    using (Font boldFont = new Font(this.Font, FontStyle.Bold))
                    {
                        g.DrawString(content.DockHandler.TabText, boldFont, ActiveTextBrush, rectText, DocumentTextStringFormat);
                    }
                }
                else
                {
                    g.DrawString(content.DockHandler.TabText, Font, InactiveTextBrush, rectText, DocumentTextStringFormat);
                }

                // Draw Icon
                if (DockPane.DockPanel.ShowDocumentIcon)
                {
                    Icon      icon     = content.DockHandler.Icon;
                    Rectangle rectIcon = default(Rectangle);
                    if (index == 0)
                    {
                        rectIcon = new Rectangle(rect.X + DocumentIconGapLeft + _DocumentTabOverlap, rectText.Y + (rect.Height - DocumentIconHeight) / 2, DocumentIconWidth, DocumentIconHeight);
                    }
                    else
                    {
                        rectIcon = new Rectangle(rect.X + DocumentIconGapLeft + _DocumentTabOverlap, rectText.Y + (rect.Height - DocumentIconHeight) / 2, DocumentIconWidth, DocumentIconHeight);
                    }
                    g.DrawIcon(content.DockHandler.Icon, rectIcon);
                }
            }
            else
            {
                if (index == 0)
                {
                    DrawHelper.DrawDocumentTab(g, rect, Color.FromArgb(254, 253, 253), Color.FromArgb(241, 239, 226), Color.FromArgb(172, 168, 153), BaseControls.Docking.DrawHelper.TabDrawType.First, true);
                }
                else
                {
                    DrawHelper.DrawDocumentTab(g, rect, Color.FromArgb(254, 253, 253), Color.FromArgb(241, 239, 226), Color.FromArgb(172, 168, 153), BaseControls.Docking.DrawHelper.TabDrawType.Inactive, true);
                }
                g.DrawLine(OutlineOuterPen, rect.X, ClientRectangle.Bottom - 1, rect.X + rect.Width, ClientRectangle.Bottom - 1);
                g.DrawString(content.DockHandler.TabText, Font, InactiveTextBrush, rectText, DocumentTextStringFormat);
            }
        }