private Rectangle RtlTransform(Rectangle rect, DockState dockState)
        {
            Rectangle rectTransformed;

            if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide)
            {
                rectTransformed = rect;
            }
            else
            {
                rectTransformed = DrawHelper.RtlTransform(this, rect);
            }

            return(rectTransformed);
        }
Beispiel #2
0
        private void DrawCaption(Graphics g)
        {
            if (ClientRectangle.Width == 0 || ClientRectangle.Height == 0)
            {
                return;
            }

            Rectangle rect = ClientRectangle;
            Color     captionColor;

            if (DockPane.IsActivePane)
            {
                captionColor = DockPane.DockPanel.Theme.ColorPalette.ToolWindowCaptionActive.Background;
            }
            else
            {
                captionColor = DockPane.DockPanel.Theme.ColorPalette.ToolWindowCaptionInactive.Background;
            }

            SolidBrush captionBrush = DockPane.DockPanel.Theme.PaintingService.GetBrush(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.Theme.ColorPalette.ToolWindowCaptionActive.Text;
            }
            else
            {
                colorText = DockPane.DockPanel.Theme.ColorPalette.ToolWindowCaptionInactive.Text;
            }

            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.Theme.ColorPalette.ToolWindowCaptionActive.Grip;
            }
            else
            {
                dotsColor = DockPane.DockPanel.Theme.ColorPalette.ToolWindowCaptionInactive.Grip;
            }

            DrawDotsStrip(g, rectDotsStrip, dotsColor);
        }