Ejemplo n.º 1
0
        private void DrawCaption(Graphics g)
        {
            if (ClientRectangle.Width == 0 || ClientRectangle.Height == 0)
            {
                return;
            }

            Rectangle rect = ClientRectangle;
            Color     captionColor;

            if (DockPane.IsActivated)
            {
                captionColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.StartColor;
            }
            else
            {
                captionColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.StartColor;
            }

            SolidBrush captionBrush = new SolidBrush(captionColor);

            g.FillRectangle(captionBrush, rect);

            Rectangle rectCaption = rect;

            Rectangle rectCaptionText = rectCaption;

            rectCaptionText.X     += TextGapLeft;
            rectCaptionText.Width -= TextGapLeft + TextGapRight;
            rectCaptionText.Width -= ButtonGapLeft + ButtonClose.Width + ButtonGapRight;
            if (ShouldShowAutoHideButton)
            {
                rectCaptionText.Width -= ButtonAutoHide.Width + ButtonGapBetween;
            }
            if (HasTabPageContextMenu)
            {
                rectCaptionText.Width -= ButtonOptions.Width + ButtonGapBetween;
            }
            rectCaptionText.Y      += TextGapTop;
            rectCaptionText.Height -= TextGapTop + TextGapBottom;

            Color colorText;

            if (DockPane.IsActivated)
            {
                colorText = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.TextColor;
            }
            else
            {
                colorText = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.TextColor;
            }

            TextRenderer.DrawText(g, DockPane.CaptionText, TextFont, DrawHelper.RtlTransform(this, rectCaptionText), colorText, TextFormat);

            Rectangle rectDotsStrip = rectCaptionText;
            int       textLength    = (int)g.MeasureString(DockPane.CaptionText, TextFont).Width + TextGapLeft;

            rectDotsStrip.X     += textLength;
            rectDotsStrip.Width -= textLength;
            rectDotsStrip.Height = ClientRectangle.Height;

            Color dotsColor;

            if (DockPane.IsActivated)
            {
                dotsColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.EndColor;
            }
            else
            {
                dotsColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.EndColor;
            }

            DrawDotsStrip(g, rectDotsStrip, dotsColor);
        }