RtlTransform() public static method

public static RtlTransform ( Control control, Point point ) : Point
control System.Windows.Forms.Control
point Point
return Point
        private void DrawCaption(Graphics g)
        {
            if (ClientRectangle.Width == 0 || ClientRectangle.Height == 0)
            {
                return;
            }

            if (DockPane.IsActivated)
            {
                Color startColor = DockPane.DockPanel.Theme.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.StartColor;
                Color endColor   = DockPane.DockPanel.Theme.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.EndColor;
                LinearGradientMode gradientMode = DockPane.DockPanel.Theme.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.LinearGradientMode;
                using (LinearGradientBrush brush = new LinearGradientBrush(ClientRectangle, startColor, endColor, gradientMode))
                {
                    brush.Blend = ActiveBackColorGradientBlend;
                    g.FillRectangle(brush, ClientRectangle);
                }
            }
            else
            {
                Color startColor = DockPane.DockPanel.Theme.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.StartColor;
                Color endColor   = DockPane.DockPanel.Theme.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.EndColor;
                LinearGradientMode gradientMode = DockPane.DockPanel.Theme.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.LinearGradientMode;
                using (LinearGradientBrush brush = new LinearGradientBrush(ClientRectangle, startColor, endColor, gradientMode))
                {
                    g.FillRectangle(brush, ClientRectangle);
                }
            }

            Rectangle rectCaption = ClientRectangle;

            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.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.TextColor;
            }
            else
            {
                colorText = DockPane.DockPanel.Theme.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.TextColor;
            }

            TextRenderer.DrawText(g, DockPane.CaptionText, TextFont, DrawHelper.RtlTransform(this, rectCaptionText), colorText, TextFormat);
        }
        private void SetButtonsPosition()
        {
            // set the size and location for close and auto-hide buttons
            Rectangle rectCaption  = ClientRectangle;
            int       buttonWidth  = ButtonClose.Image.Width;
            int       buttonHeight = ButtonClose.Image.Height;
            int       height       = rectCaption.Height - ButtonGapTop - ButtonGapBottom;

            if (buttonHeight < height)
            {
                buttonWidth  = buttonWidth * height / buttonHeight;
                buttonHeight = height;
            }
            Size  buttonSize = new Size(buttonWidth, buttonHeight);
            int   x          = rectCaption.X + rectCaption.Width - 1 - ButtonGapRight - m_buttonClose.Width;
            int   y          = rectCaption.Y + ButtonGapTop;
            Point point      = new Point(x, y);

            ButtonClose.Bounds = DrawHelper.RtlTransform(this, new Rectangle(point, buttonSize));

            // If the close button is not visible draw the auto hide button overtop.
            // Otherwise it is drawn to the left of the close button.
            if (CloseButtonVisible)
            {
                point.Offset(-(buttonWidth + ButtonGapBetween), 0);
            }

            ButtonAutoHide.Bounds = DrawHelper.RtlTransform(this, new Rectangle(point, buttonSize));
            if (ShouldShowAutoHideButton)
            {
                point.Offset(-(buttonWidth + ButtonGapBetween), 0);
            }
            ButtonOptions.Bounds = DrawHelper.RtlTransform(this, new Rectangle(point, buttonSize));
        }
        private void SetButtonsPosition()
        {
            // set the size and location for close and auto-hide buttons
            Rectangle rectCaption  = this.ClientRectangle;
            int       buttonWidth  = this.ButtonClose.Image.Width;
            int       buttonHeight = this.ButtonClose.Image.Height;
            int       height       = rectCaption.Height - ButtonGapTop - ButtonGapBottom;

            if (buttonHeight < height)
            {
                buttonWidth  = buttonWidth * (height / buttonHeight);
                buttonHeight = height;
            }
            Size  buttonSize = new Size(buttonWidth, buttonHeight);
            int   x          = rectCaption.X + rectCaption.Width - 1 - ButtonGapRight - this.m_buttonClose.Width;
            int   y          = rectCaption.Y + ButtonGapTop;
            Point point      = new Point(x, y);

            this.ButtonClose.Bounds = DrawHelper.RtlTransform(this, new Rectangle(point, buttonSize));
            point.Offset(-(buttonWidth + ButtonGapBetween), 0);
            this.ButtonAutoHide.Bounds = DrawHelper.RtlTransform(this, new Rectangle(point, buttonSize));
            if (this.ShouldShowAutoHideButton)
            {
                point.Offset(-(buttonWidth + ButtonGapBetween), 0);
            }
            this.ButtonOptions.Bounds = DrawHelper.RtlTransform(this, new Rectangle(point, buttonSize));
        }
        private void DrawCaption(Graphics g)
        {
            if (ClientRectangle.Width == 0 || ClientRectangle.Height == 0)
            {
                return;
            }

            Rectangle rect   = ClientRectangle;
            var       border = DockPane.DockPanel.Theme.ColorPalette.ToolWindowBorder;
            ToolWindowCaptionPalette palette;

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

            SolidBrush captionBrush = DockPane.DockPanel.Theme.PaintingService.GetBrush(palette.Background);

            g.FillRectangle(captionBrush, rect);

            g.DrawLine(DockPane.DockPanel.Theme.PaintingService.GetPen(border), rect.Left, rect.Top,
                       rect.Left, rect.Bottom);
            g.DrawLine(DockPane.DockPanel.Theme.PaintingService.GetPen(border), rect.Left, rect.Top,
                       rect.Right, rect.Top);
            g.DrawLine(DockPane.DockPanel.Theme.PaintingService.GetPen(border), rect.Right - 1, rect.Top,
                       rect.Right - 1, rect.Bottom);

            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;

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

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

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

            DrawDotsStrip(g, rectDotsStrip, palette.Grip);
        }
Esempio n. 5
0
        protected override void OnLayout(LayoutEventArgs levent)
        {
            if (Appearance != DockPane.AppearanceStyle.Document)
            {
                base.OnLayout(levent);
                return;
            }

            Rectangle rectTabStrip = TabStripRectangle;

            // Set position and size of the buttons
            int buttonWidth  = ButtonClose.Image.Width;
            int buttonHeight = ButtonClose.Image.Height;
            int height       = rectTabStrip.Height - DocumentButtonGapTop - DocumentButtonGapBottom;

            if (buttonHeight < height)
            {
                buttonWidth  = buttonWidth * (height / buttonHeight);
                buttonHeight = height;
            }
            Size buttonSize = new Size(buttonWidth, buttonHeight);

            int x = rectTabStrip.X + rectTabStrip.Width - DocumentTabGapLeft
                    - DocumentButtonGapRight - buttonWidth;
            int   y     = rectTabStrip.Y + DocumentButtonGapTop;
            Point point = new Point(x, y);

            ButtonClose.Bounds = DrawHelper.RtlTransform(this, new Rectangle(point, buttonSize));
            point.Offset(-(DocumentButtonGapBetween + buttonWidth), 0);
            ButtonWindowList.Bounds = DrawHelper.RtlTransform(this, new Rectangle(point, buttonSize));

            OnRefreshChanges();

            base.OnLayout(levent);
        }
Esempio n. 6
0
        private void DrawCaption(Graphics g)
        {
            if (ClientRectangle.Width == 0 || ClientRectangle.Height == 0)
            {
                return;
            }

            Pen borderPen = SystemPens.ControlDark;

            Color color = PluginCore.PluginBase.MainForm.GetThemeColor("VS2005DockPaneCaption.BorderColor");

            if (color != Color.Empty)
            {
                borderPen = new Pen(color);
            }

            if (DockPane.IsActivated)
            {
                // HACK: Looks more like VS2005..
                LinearGradientBrush brush = new LinearGradientBrush(ClientRectangle, ActiveBackColorGradientBegin, ActiveBackColorGradientEnd, LinearGradientMode.Vertical);
                brush.Blend = ActiveBackColorGradientBlend;
                g.FillRectangle(brush, ClientRectangle);
                Rectangle fixedRect = ClientRectangle;
                fixedRect.Height -= 1;
                fixedRect.Width  -= 1;
                g.DrawRectangle(borderPen, fixedRect);
            }
            else
            {
                // HACK: Looks more like VS2005..
                SolidBrush fillBrush = new SolidBrush(InactiveBackColor);
                g.FillRectangle(fillBrush, ClientRectangle);
                Rectangle fixedRect = ClientRectangle;
                fixedRect.Height -= 1;
                fixedRect.Width  -= 1;
                g.DrawRectangle(borderPen, fixedRect);
            }

            Rectangle rectCaption = ClientRectangle;

            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;
            TextRenderer.DrawText(g, DockPane.CaptionText, Font, DrawHelper.RtlTransform(this, rectCaptionText), TextColor, TextFormat);
        }
        private void DrawTab_Document(Graphics g, TabVS2005 tab, Rectangle rect)
        {
            if (tab.TabWidth == 0)
            {
                return;
            }

            Rectangle rectIcon = new Rectangle(
                rect.X + DocumentIconGapLeft,
                rect.Y + rect.Height - 1 - DocumentIconGapBottom - DocumentIconHeight,
                DocumentIconWidth, DocumentIconHeight);
            Rectangle rectText = rectIcon;

            if (DockPane.DockPanel.ShowDocumentIcon)
            {
                rectText.X    += rectIcon.Width + DocumentIconGapRight;
                rectText.Y     = rect.Y;
                rectText.Width = rect.Width - rectIcon.Width - DocumentIconGapLeft -
                                 DocumentIconGapRight - DocumentTextGapRight;
                rectText.Height = rect.Height;
            }
            else
            {
                rectText.Width = rect.Width - DocumentIconGapLeft - DocumentTextGapRight;
            }

            Rectangle rectTab = DrawHelper.RtlTransform(this, rect);

            rectText = DrawHelper.RtlTransform(this, rectText);
            rectIcon = DrawHelper.RtlTransform(this, rectIcon);
            GraphicsPath path = GetTabOutline(tab, true, false);

            if (DockPane.ActiveContent == tab.Content)
            {
                g.FillPath(BrushDocumentActiveBackground, path);
                g.DrawPath(PenDocumentTabActiveBorder, path);
                if (DockPane.IsActiveDocumentPane)
                {
                    TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, BoldFont, rectText, ColorDocumentActiveText, DocumentTextFormat);
                }
                else
                {
                    TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, Font, rectText, ColorDocumentActiveText, DocumentTextFormat);
                }
            }
            else
            {
                g.FillPath(BrushDocumentInactiveBackground, path);
                g.DrawPath(PenDocumentTabInactiveBorder, path);
                TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, Font, rectText, ColorDocumentInactiveText, DocumentTextFormat);
            }

            if (rectTab.Contains(rectIcon) && DockPane.DockPanel.ShowDocumentIcon)
            {
                g.DrawIcon(tab.Content.DockHandler.Icon, rectIcon);
            }
        }
 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;
 }
Esempio n. 9
0
        private GraphicsPath GetTabOutline_ToolWindow(Tab tab, bool rtlTransform, bool toScreen)
        {
            Rectangle rect = this.GetTabRectangle(this.Tabs.IndexOf(tab));

            if (rtlTransform)
            {
                rect = DrawHelper.RtlTransform(this, rect);
            }
            if (toScreen)
            {
                rect = this.RectangleToScreen(rect);
            }
            DrawHelper.GetRoundedCornerTab(GraphicsPath, rect, false);
            return(GraphicsPath);
        }
Esempio n. 10
0
        private void DrawTab_ToolWindow(Graphics g, TabVS2005 tab, Rectangle rect)
        {
            Rectangle rectIcon = new Rectangle(
                rect.X + ToolWindowImageGapLeft,
                rect.Y + rect.Height - 1 - ToolWindowImageGapBottom - ToolWindowImageHeight,
                ToolWindowImageWidth, ToolWindowImageHeight);
            Rectangle rectText = rectIcon;

            rectText.X    += rectIcon.Width + ToolWindowImageGapRight;
            rectText.Width = rect.Width - rectIcon.Width - ToolWindowImageGapLeft -
                             ToolWindowImageGapRight - ToolWindowTextGapRight;

            Rectangle rectTab = DrawHelper.RtlTransform(this, rect);

            rectText = DrawHelper.RtlTransform(this, rectText);
            rectIcon = DrawHelper.RtlTransform(this, rectIcon);
            GraphicsPath path = GetTabOutline(tab, true, false);

            if (DockPane.ActiveContent == tab.Content)
            {
                g.FillPath(BrushToolWindowActiveBackground, path);
                g.DrawPath(PenToolWindowTabBorder, path);

                // NICK: eliminate line between tab and content
                RectangleF r = path.GetBounds();
                using (Pen pen = new Pen(Color.FromArgb(240, 239, 243)))
                    g.DrawLine(pen, r.Left + 1, r.Top, r.Right - 1, r.Top);

                TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, Font, rectText, ColorToolWindowActiveText, ToolWindowTextFormat);
            }
            else
            {
                // NICK: remove separators, too busy for FD

                /*if (Tabs.IndexOf(DockPane.ActiveContent) != Tabs.IndexOf(tab) + 1)
                 * {
                 *  Point pt1 = new Point(rect.Right, rect.Top + ToolWindowTabSeperatorGapTop);
                 *  Point pt2 = new Point(rect.Right, rect.Bottom - ToolWindowTabSeperatorGapBottom);
                 *  g.DrawLine(PenToolWindowTabBorder, DrawHelper.RtlTransform(this, pt1), DrawHelper.RtlTransform(this, pt2));
                 * }*/
                TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, Font, rectText, ColorToolWindowInactiveText, ToolWindowTextFormat);
            }

            if (rectTab.Contains(rectIcon))
            {
                g.DrawIcon(tab.Content.DockHandler.Icon, rectIcon);
            }
        }
Esempio n. 11
0
        private void DrawTab_ToolWindow(Graphics g, TabVS2005 tab, Rectangle rect)
        {
            Rectangle rectIcon = new Rectangle(
                rect.X + ToolWindowImageGapLeft,
                rect.Y + rect.Height - 1 - ToolWindowImageGapBottom - ToolWindowImageHeight,
                ToolWindowImageWidth, ToolWindowImageHeight);
            Rectangle rectText = rectIcon;

            rectText.X    += rectIcon.Width + ToolWindowImageGapRight;
            rectText.Width = rect.Width - rectIcon.Width - ToolWindowImageGapLeft -
                             ToolWindowImageGapRight - ToolWindowTextGapRight;
            if (TextFont.Height > rectIcon.Height)
            {
                rectText.Y     -= TextFont.Height - rectIcon.Height;
                rectText.Height = TextFont.Height;
            }
            //rectText.Y = rect.Y + Convert.ToInt32((rect.Height - TextFont.Height) / 2) - 1;
            //rectText.Height = TextFont.Height;

            Rectangle rectTab = DrawHelper.RtlTransform(this, rect);

            rectText = DrawHelper.RtlTransform(this, rectText);
            rectIcon = DrawHelper.RtlTransform(this, rectIcon);
            GraphicsPath path = GetTabOutline(tab, true, false);

            if (DockPane.ActiveContent == tab.Content)
            {
                g.FillPath(BrushToolWindowActiveBackground, path);
                g.DrawPath(PenToolWindowTabBorder, path);
                TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, TextFont, rectText, ColorToolWindowActiveText, ToolWindowTextFormat);
            }
            else
            {
                if (Tabs.IndexOf(DockPane.ActiveContent) != Tabs.IndexOf(tab) + 1)
                {
                    Point pt1 = new Point(rect.Right, rect.Top + ToolWindowTabSeperatorGapTop);
                    Point pt2 = new Point(rect.Right, rect.Bottom - ToolWindowTabSeperatorGapBottom);
                    g.DrawLine(PenToolWindowTabBorder, DrawHelper.RtlTransform(this, pt1), DrawHelper.RtlTransform(this, pt2));
                }
                TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, TextFont, rectText, ColorToolWindowInactiveText, ToolWindowTextFormat);
            }

            if (rectTab.Contains(rectIcon))
            {
                g.DrawIcon(tab.Content.DockHandler.Icon, rectIcon);
            }
        }
Esempio n. 12
0
        private void DrawCaption(Graphics g)
        {
            if (DockPane.IsActivated)
            {
                using (LinearGradientBrush brush = new LinearGradientBrush(ClientRectangle, ActiveBackColorGradientBegin, ActiveBackColorGradientEnd, LinearGradientMode.Vertical))
                {
                    g.FillRectangle(brush, ClientRectangle);
                }
            }
            else
            {
                using (SolidBrush brush = new SolidBrush(InactiveBackColor))
                {
                    g.FillRectangle(brush, ClientRectangle);
                }
            }

            Rectangle rectCaption = ClientRectangle;

            if (!DockPane.IsActivated)
            {
                using (Pen pen = new Pen(InactiveBorderColor))
                {
                    g.DrawLine(pen, rectCaption.X + 1, rectCaption.Y, rectCaption.X + rectCaption.Width - 2, rectCaption.Y);
                    g.DrawLine(pen, rectCaption.X + 1, rectCaption.Y + rectCaption.Height - 1, rectCaption.X + rectCaption.Width - 2, rectCaption.Y + rectCaption.Height - 1);
                    g.DrawLine(pen, rectCaption.X, rectCaption.Y + 1, rectCaption.X, rectCaption.Y + rectCaption.Height - 2);
                    g.DrawLine(pen, rectCaption.X + rectCaption.Width - 1, rectCaption.Y + 1, rectCaption.X + rectCaption.Width - 1, rectCaption.Y + rectCaption.Height - 2);
                }
            }

            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;
            TextRenderer.DrawText(g, DockPane.CaptionText, Font, DrawHelper.RtlTransform(this, rectCaptionText), DockPane.IsActivated ? ActiveTextColor : InactiveTextColor, TextFormat);
        }
        private void DrawTabStrip_Document(Graphics g)
        {
            int count = Tabs.Count;

            if (count == 0)
            {
                return;
            }

            Rectangle rectTabStrip = TabStripRectangle;

            // Draw the tabs
            Rectangle rectTabOnly = TabsRectangle;
            Rectangle rectTab     = Rectangle.Empty;
            TabVS2005 tabActive   = null;

            g.SetClip(DrawHelper.RtlTransform(this, rectTabOnly));
            for (int i = 0; i < count; i++)
            {
                rectTab = GetTabRectangle(i);
                if (Tabs[i].Content == DockPane.ActiveContent)
                {
                    tabActive = Tabs[i] as TabVS2005;
                    continue;
                }
                if (rectTab.IntersectsWith(rectTabOnly))
                {
                    DrawTab(g, Tabs[i] as TabVS2005, rectTab);
                }
            }

            g.SetClip(rectTabStrip);
            g.DrawLine(PenDocumentTabActiveBorder, rectTabStrip.Left, rectTabStrip.Bottom - 1,
                       rectTabStrip.Right, rectTabStrip.Bottom - 1);
            g.SetClip(DrawHelper.RtlTransform(this, rectTabOnly));
            if (tabActive != null)
            {
                rectTab = GetTabRectangle(Tabs.IndexOf(tabActive));
                if (rectTab.IntersectsWith(rectTabOnly))
                {
                    DrawTab(g, tabActive, rectTab);
                }
            }
        }
Esempio n. 14
0
        private GraphicsPath GetOutline_ToolWindow(int index)
        {
            Rectangle rectTab = this.GetTabRectangle(index);

            rectTab.Intersect(this.TabsRectangle);
            rectTab = this.RectangleToScreen(DrawHelper.RtlTransform(this, rectTab));
            int          y = rectTab.Top;
            Rectangle    rectPaneClient = this.DockPane.RectangleToScreen(this.DockPane.ClientRectangle);
            GraphicsPath path           = new GraphicsPath();
            GraphicsPath pathTab        = this.GetTabOutline(this.Tabs[index], true, true);

            path.AddPath(pathTab, true);
            path.AddLine(rectTab.Left, rectTab.Top, rectPaneClient.Left, rectTab.Top);
            path.AddLine(rectPaneClient.Left, rectTab.Top, rectPaneClient.Left, rectPaneClient.Top);
            path.AddLine(rectPaneClient.Left, rectPaneClient.Top, rectPaneClient.Right, rectPaneClient.Top);
            path.AddLine(rectPaneClient.Right, rectPaneClient.Top, rectPaneClient.Right, rectTab.Top);
            path.AddLine(rectPaneClient.Right, rectTab.Top, rectTab.Right, rectTab.Top);
            return(path);
        }
        private void DrawCaption(Graphics g)
        {
            if (ClientRectangle.Width == 0 || ClientRectangle.Height == 0)
            {
                return;
            }

            if (DockPane.IsActivated)
            {
                using (LinearGradientBrush brush = new LinearGradientBrush(ClientRectangle, ActiveBackColorGradientBegin, ActiveBackColorGradientEnd, LinearGradientMode.Vertical))
                {
                    brush.Blend = ActiveBackColorGradientBlend;
                    g.FillRectangle(brush, ClientRectangle);
                }
            }
            else
            {
                using (SolidBrush brush = new SolidBrush(InactiveBackColor))
                {
                    g.FillRectangle(brush, ClientRectangle);
                }
                g.DrawRectangle(SystemPens.ControlDark, new Rectangle(0, 0, ClientSize.Width - 1, ClientSize.Height - 1));
            }

            Rectangle rectCaption = ClientRectangle;

            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;
            TextRenderer.DrawText(g, DockPane.CaptionText, TextFont, DrawHelper.RtlTransform(this, rectCaptionText), TextColor, TextFormat);
        }
        private GraphicsPath GetOutline_Document(int index)
        {
            Rectangle rectTab = GetTabRectangle(index);

            rectTab.X -= rectTab.Height / 2;
            rectTab.Intersect(TabsRectangle);
            rectTab = RectangleToScreen(DrawHelper.RtlTransform(this, rectTab));
            int       y = rectTab.Top;
            Rectangle rectPaneClient = DockPane.RectangleToScreen(DockPane.ClientRectangle);

            GraphicsPath path    = new GraphicsPath();
            GraphicsPath pathTab = GetTabOutline_Document(Tabs[index], true, true, true);

            path.AddPath(pathTab, true);
            path.AddLine(rectTab.Right, rectTab.Bottom, rectPaneClient.Right, rectTab.Bottom);
            path.AddLine(rectPaneClient.Right, rectTab.Bottom, rectPaneClient.Right, rectPaneClient.Bottom);
            path.AddLine(rectPaneClient.Right, rectPaneClient.Bottom, rectPaneClient.Left, rectPaneClient.Bottom);
            path.AddLine(rectPaneClient.Left, rectPaneClient.Bottom, rectPaneClient.Left, rectTab.Bottom);
            path.AddLine(rectPaneClient.Left, rectTab.Bottom, rectTab.Right, rectTab.Bottom);
            return(path);
        }
        /*
         *      private void DrawCaption(Graphics g)
         *      {
         *  if (ClientRectangle.Width == 0 || ClientRectangle.Height == 0)
         *      return;
         *
         *  if (DockPane.IsActivated)
         *  {
         *      Color startColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.StartColor;
         *      Color endColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.EndColor;
         *      LinearGradientMode gradientMode = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.LinearGradientMode;
         *      using (LinearGradientBrush brush = new LinearGradientBrush(ClientRectangle, startColor, endColor, gradientMode))
         *      {
         *          Rectangle rect = ClientRectangle;
         *          rect.Height = rect.Height / 2;
         *          brush.Blend = ActiveBackColorGradientBlend;
         *          g.FillRectangle(brush, rect);
         *      }
         *  }
         *  else
         *  {
         *      Color startColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.StartColor;
         *      Color endColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.EndColor;
         *      LinearGradientMode gradientMode = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.LinearGradientMode;
         *      using (LinearGradientBrush brush = new LinearGradientBrush(ClientRectangle, startColor, endColor, gradientMode))
         *      {
         *          g.FillRectangle(brush, ClientRectangle);
         *      }
         *  }
         *
         *              Rectangle rectCaption = ClientRectangle;
         *
         *              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);
         *      }
         * */

        #region ActiveSphere modified
        private void DrawCaption(Graphics g)
        {
            if (ClientRectangle.Width == 0 || ClientRectangle.Height == 0)
            {
                return;
            }

            if (DockPane.IsActivated)
            {
                //TopBorder
                Color startColorTopBorder       = Color.FromArgb(255, 216, 202, 149);
                Color endColorTopBorder         = Color.FromArgb(255, 216, 194, 120);
                LinearGradientMode gradientMode = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.LinearGradientMode;
                Rectangle          borderRect   = ClientRectangle;
                borderRect.Height = (borderRect.Height / 2) - 1;
                using (LinearGradientBrush brush = new LinearGradientBrush(borderRect, startColorTopBorder, endColorTopBorder, gradientMode))
                {
                    brush.Blend = ActiveBackColorGradientBlend;
                    g.FillRectangle(brush, borderRect);
                }

                //Bottom Border
                Color     startColorBottomBorder = Color.FromArgb(255, 216, 194, 120);
                Color     endColorBottomBorder   = Color.FromArgb(255, 216, 202, 149);
                Rectangle bottomBorderRect       = borderRect;
                bottomBorderRect.Y       = borderRect.Height;
                bottomBorderRect.Height += 2;
                using (LinearGradientBrush brush = new LinearGradientBrush(bottomBorderRect, startColorBottomBorder, endColorBottomBorder, gradientMode))
                {
                    brush.Blend = ActiveBackColorGradientBlend;
                    g.FillRectangle(brush, bottomBorderRect);
                }

                //TopBorderSecond
                Color     startColorBorderSecond = Color.FromArgb(255, 255, 255, 249);
                Color     endColorBorderSecond   = Color.FromArgb(255, 255, 250, 231);
                Rectangle borderRectSecond       = borderRect;
                borderRectSecond.Height = borderRect.Height;
                borderRectSecond.Width -= 2;
                borderRectSecond.Y     += 1;
                borderRectSecond.X     += 1;
                using (LinearGradientBrush brush = new LinearGradientBrush(borderRectSecond, startColorBorderSecond, endColorBorderSecond, gradientMode))
                {
                    brush.Blend = ActiveBackColorGradientBlend;
                    g.FillRectangle(brush, borderRectSecond);
                }


                //Bottom Border Second
                Color     startColorBottomBorderSecond = Color.FromArgb(255, 255, 242, 200);
                Color     endColorBottomBorderSecond   = Color.FromArgb(255, 255, 247, 185);
                Rectangle bottomBorderRectSecond       = borderRect;
                bottomBorderRectSecond.Y      = borderRect.Height + 1;
                bottomBorderRectSecond.X     += 1;
                bottomBorderRectSecond.Width -= 2;

                using (LinearGradientBrush brush = new LinearGradientBrush(bottomBorderRectSecond, startColorBottomBorderSecond, endColorBottomBorderSecond, gradientMode))
                {
                    brush.Blend = ActiveBackColorGradientBlend;
                    g.FillRectangle(brush, bottomBorderRectSecond);
                }



                Color     startColorFirst = Color.FromArgb(255, 255, 249, 218);
                Color     endColorFirst   = Color.FromArgb(255, 255, 238, 177);
                Rectangle rect            = ClientRectangle;
                rect.Height = (rect.Height / 2) - 1;
                rect.Width -= 3;
                rect.X     += 2;
                rect.Y     += 2;
                using (LinearGradientBrush brush = new LinearGradientBrush(rect, startColorFirst, endColorFirst, gradientMode))
                {
                    brush.Blend = ActiveBackColorGradientBlend;
                    g.FillRectangle(brush, rect);
                }


                Color     startColorSecond = Color.FromArgb(255, 255, 214, 107);
                Color     endColorSecond   = Color.FromArgb(255, 255, 224, 135);
                Rectangle rectSecond       = rect;
                rectSecond.Y      = rect.Height + 1;
                rectSecond.Height = rect.Height - 1;
                using (LinearGradientBrush brush = new LinearGradientBrush(rectSecond, startColorSecond, endColorSecond, gradientMode))
                {
                    brush.Blend = ActiveBackColorGradientBlend;
                    g.FillRectangle(brush, rectSecond);
                }
            }
            else
            {
                Color startColorBorder;
                Color endColorBorder;
                Color startColorBottomBorder;
                Color endColorBottomBorder;
                Color startColorBorderSecond;
                Color endColorBorderSecond;
                Color startColorBottomBorderSecond;
                Color endColorBottomBorderSecond;
                Color startColorFirst;
                Color endColorFirst;
                Color startColorSecond;
                Color endColorSecond;
                if (DockPane.DockPanel.Skin.BlueSkin)
                {
                    //TopBorder
                    startColorBorder = Color.FromArgb(255, 111, 157, 217);
                    endColorBorder   = Color.FromArgb(255, 111, 157, 217);

                    //Bottom Border
                    startColorBottomBorder = Color.FromArgb(255, 111, 157, 217);
                    endColorBottomBorder   = Color.FromArgb(255, 111, 157, 217);

                    //TopBorderSecond
                    startColorBorderSecond = Color.FromArgb(255, 241, 247, 255);
                    endColorBorderSecond   = Color.FromArgb(255, 241, 247, 255);

                    //Bottom Border Second
                    startColorBottomBorderSecond = Color.FromArgb(200, 191, 219, 255);
                    endColorBottomBorderSecond   = Color.FromArgb(255, 191, 219, 255);

                    startColorFirst = Color.FromArgb(255, 227, 239, 255);
                    endColorFirst   = Color.FromArgb(255, 227, 239, 255);

                    startColorSecond = Color.FromArgb(255, 223, 237, 255);
                    endColorSecond   = Color.FromArgb(255, 181, 213, 255);
                }
                else
                {
                    //TopBorder
                    //startColorBorder = Color.FromArgb(255, 124, 124, 148);
                    //endColorBorder = Color.FromArgb(255, 124, 124, 148);

                    startColorBorder = Color.FromArgb(255, 182, 188, 204);
                    endColorBorder   = Color.FromArgb(255, 182, 188, 204);


                    //Bottom Border
                    startColorBottomBorder = Color.FromArgb(255, 182, 188, 204);
                    endColorBottomBorder   = Color.FromArgb(255, 182, 188, 204);

                    //TopBorderSecond
                    startColorBorderSecond = Color.FromArgb(255, 241, 247, 255);
                    endColorBorderSecond   = Color.FromArgb(255, 241, 247, 255);

                    //Bottom Border Second
                    startColorBottomBorderSecond = Color.FromArgb(255, 241, 247, 255);
                    endColorBottomBorderSecond   = Color.FromArgb(255, 241, 247, 255);

                    //startColorFirst = Color.FromArgb(255, 243, 244, 250);
                    //endColorFirst = Color.FromArgb(255, 227, 228, 227);
                    startColorFirst = Color.FromArgb(255, 255, 255, 255);
                    endColorFirst   = Color.FromArgb(255, 227, 232, 244);

                    //startColorSecond = Color.FromArgb(255, 178, 177, 199);
                    //endColorSecond = Color.FromArgb(255, 227, 228, 227);

                    startColorSecond = Color.FromArgb(255, 208, 215, 236);
                    endColorSecond   = Color.FromArgb(255, 233, 236, 250);
                }



                LinearGradientMode gradientMode = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.LinearGradientMode;
                Rectangle          borderRect   = ClientRectangle;
                borderRect.Height = (borderRect.Height / 2) - 1;
                using (LinearGradientBrush brush = new LinearGradientBrush(borderRect, startColorBorder, endColorBorder, gradientMode))
                {
                    brush.Blend = ActiveBackColorGradientBlend;
                    g.FillRectangle(brush, borderRect);
                }


                Rectangle bottomBorderRect = borderRect;
                bottomBorderRect.Y       = borderRect.Height;
                bottomBorderRect.Height += 2;
                using (LinearGradientBrush brush = new LinearGradientBrush(bottomBorderRect, startColorBottomBorder, endColorBottomBorder, gradientMode))
                {
                    brush.Blend = ActiveBackColorGradientBlend;
                    g.FillRectangle(brush, bottomBorderRect);
                }


                Rectangle borderRectSecond = borderRect;
                borderRectSecond.Height = borderRect.Height;
                borderRectSecond.Width -= 2;
                borderRectSecond.Y     += 1;
                borderRectSecond.X     += 1;
                using (LinearGradientBrush brush = new LinearGradientBrush(borderRectSecond, startColorBorderSecond, endColorBorderSecond, gradientMode))
                {
                    brush.Blend = ActiveBackColorGradientBlend;
                    g.FillRectangle(brush, borderRectSecond);
                }



                Rectangle bottomBorderRectSecond = borderRect;
                bottomBorderRectSecond.Y      = borderRect.Height + 1;
                bottomBorderRectSecond.X     += 1;
                bottomBorderRectSecond.Width -= 2;

                using (LinearGradientBrush brush = new LinearGradientBrush(bottomBorderRectSecond, startColorBottomBorderSecond, endColorBottomBorderSecond, gradientMode))
                {
                    brush.Blend = ActiveBackColorGradientBlend;
                    g.FillRectangle(brush, bottomBorderRectSecond);
                }



                Rectangle rect = ClientRectangle;
                rect.Height = (rect.Height / 2) - 1;
                rect.Width -= 3;
                rect.X     += 2;
                rect.Y     += 2;
                using (LinearGradientBrush brush = new LinearGradientBrush(rect, startColorFirst, endColorFirst, gradientMode))
                {
                    brush.Blend = ActiveBackColorGradientBlend;
                    g.FillRectangle(brush, rect);
                }



                Rectangle rectSecond = rect;
                rectSecond.Y      = rect.Height + 1;
                rectSecond.Height = rect.Height - 1;
                using (LinearGradientBrush brush = new LinearGradientBrush(rectSecond, startColorSecond, endColorSecond, gradientMode))
                {
                    brush.Blend = ActiveBackColorGradientBlend;
                    g.FillRectangle(brush, rectSecond);
                }
            }

            Rectangle rectCaption = ClientRectangle;

            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);
        }
        private GraphicsPath GetTabOutline_Document(Tab tab, bool rtlTransform, bool toScreen, bool full)
        {
            int curveSize = 6;

            GraphicsPath.Reset();
            Rectangle rect = GetTabRectangle(Tabs.IndexOf(tab));

            if (rtlTransform)
            {
                rect = DrawHelper.RtlTransform(this, rect);
            }
            if (toScreen)
            {
                rect = RectangleToScreen(rect);
            }

            if (tab.Content == DockPane.ActiveContent || Tabs.IndexOf(tab) == StartDisplayingTab || full)
            {
                if (RightToLeft == RightToLeft.Yes)
                {
                    GraphicsPath.AddLine(rect.Right, rect.Bottom, rect.Right + rect.Height / 2, rect.Bottom);
                    GraphicsPath.AddLine(rect.Right + rect.Height / 2, rect.Bottom, rect.Right - rect.Height / 2 + curveSize / 2, rect.Top + curveSize / 2);
                }
                else
                {
                    GraphicsPath.AddLine(rect.Left, rect.Bottom, rect.Left - rect.Height / 2, rect.Bottom);
                    GraphicsPath.AddLine(rect.Left - rect.Height / 2, rect.Bottom, rect.Left + rect.Height / 2 - curveSize / 2, rect.Top + curveSize / 2);
                }
            }
            else
            {
                if (RightToLeft == RightToLeft.Yes)
                {
                    GraphicsPath.AddLine(rect.Right, rect.Bottom, rect.Right, rect.Bottom - rect.Height / 2);
                    GraphicsPath.AddLine(rect.Right, rect.Bottom - rect.Height / 2, rect.Right - rect.Height / 2 + curveSize / 2, rect.Top + curveSize / 2);
                }
                else
                {
                    GraphicsPath.AddLine(rect.Left, rect.Bottom, rect.Left, rect.Bottom - rect.Height / 2);
                    GraphicsPath.AddLine(rect.Left, rect.Bottom - rect.Height / 2, rect.Left + rect.Height / 2 - curveSize / 2, rect.Top + curveSize / 2);
                }
            }

            if (RightToLeft == RightToLeft.Yes)
            {
                GraphicsPath.AddLine(rect.Right - rect.Height / 2 - curveSize / 2, rect.Top, rect.Left + curveSize / 2, rect.Top);
                GraphicsPath.AddArc(new Rectangle(rect.Left, rect.Top, curveSize, curveSize), 180, 90);
            }
            else
            {
                GraphicsPath.AddLine(rect.Left + rect.Height / 2 + curveSize / 2, rect.Top, rect.Right - curveSize / 2, rect.Top);
                GraphicsPath.AddArc(new Rectangle(rect.Right - curveSize, rect.Top, curveSize, curveSize), -90, 90);
            }

            if (Tabs.IndexOf(tab) != EndDisplayingTab &&
                (Tabs.IndexOf(tab) != Tabs.Count - 1 && Tabs[Tabs.IndexOf(tab) + 1].Content == DockPane.ActiveContent) &&
                !full)
            {
                if (RightToLeft == RightToLeft.Yes)
                {
                    GraphicsPath.AddLine(rect.Left, rect.Top + curveSize / 2, rect.Left, rect.Top + rect.Height / 2);
                    GraphicsPath.AddLine(rect.Left, rect.Top + rect.Height / 2, rect.Left + rect.Height / 2, rect.Bottom);
                }
                else
                {
                    GraphicsPath.AddLine(rect.Right, rect.Top + curveSize / 2, rect.Right, rect.Top + rect.Height / 2);
                    GraphicsPath.AddLine(rect.Right, rect.Top + rect.Height / 2, rect.Right - rect.Height / 2, rect.Bottom);
                }
            }
            else
            {
                if (RightToLeft == RightToLeft.Yes)
                {
                    GraphicsPath.AddLine(rect.Left, rect.Top + curveSize / 2, rect.Left, rect.Bottom);
                }
                else
                {
                    GraphicsPath.AddLine(rect.Right, rect.Top + curveSize / 2, rect.Right, rect.Bottom);
                }
            }

            return(GraphicsPath);
        }
        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);
        }
Esempio n. 20
0
        private void DrawTab_Document(Graphics g, TabVS2005 tab, Rectangle rect)
        {
            if (tab.TabWidth == 0)
            {
                return;
            }

            Rectangle rectIcon = new Rectangle(
                rect.X + DocumentIconGapLeft,
                rect.Y + rect.Height - 1 - DocumentIconGapBottom - DocumentIconHeight,
                DocumentIconWidth, DocumentIconHeight);
            Rectangle rectText = rectIcon;

            // CHANGED - NICK
            rectText.Y += 2;

            // CHANGED - MIKA
            if (Font.SizeInPoints <= 8F)
            {
                rectText.Y -= 1;
            }

            if (DockPane.DockPanel.ShowDocumentIcon)
            {
                rectText.X    += rectIcon.Width + DocumentIconGapRight;
                rectText.Y     = rect.Y;
                rectText.Width = rect.Width - rectIcon.Width - DocumentIconGapLeft -
                                 DocumentIconGapRight - DocumentTextGapRight;
                rectText.Height = rect.Height;
            }
            else
            {
                rectText.Width = rect.Width - DocumentIconGapLeft - DocumentTextGapRight;
            }

            Rectangle rectTab = DrawHelper.RtlTransform(this, rect);

            rectText = DrawHelper.RtlTransform(this, rectText);
            rectIcon = DrawHelper.RtlTransform(this, rectIcon);
            GraphicsPath path = GetTabOutline(tab, true, false);

            if (DockPane.ActiveContent == tab.Content)
            {
                g.FillPath(BrushDocumentActiveBackground, path);
                g.DrawPath(PenDocumentTabActiveBorder, path);

                // CHANGED to eliminate line between selected tab and content - NICK
                RectangleF r = path.GetBounds();

                using (Pen pen = new Pen(Color.FromArgb(240, 239, 243)))
                {
                    g.DrawLine(pen, r.Left + 2, r.Bottom - 1, r.Right - 1, r.Bottom - 1);
                }

                if (DockPane.IsActiveDocumentPane)
                {
                    TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, BoldFont, rectText, ColorDocumentActiveText, DocumentTextFormat);
                }
                else
                {
                    TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, Font, rectText, ColorDocumentInactiveText, DocumentTextFormat);
                }
            }
            else
            {
                // CHANGE by NICK: emulate VS-style inactive tab gradient
                Brush tabBrush = new LinearGradientBrush(rectTab,
                                                         SystemColors.ControlLightLight, SystemColors.ControlLight, LinearGradientMode.Vertical);

                //g.FillPath(BrushDocumentInactiveBackground, path);
                g.FillPath(tabBrush, path);
                g.DrawPath(PenDocumentTabInactiveBorder, path);
                TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, Font, rectText, ColorDocumentInactiveText, DocumentTextFormat);
            }

            if (rectTab.Contains(rectIcon) && DockPane.DockPanel.ShowDocumentIcon)
            {
                g.DrawIcon(tab.Content.DockHandler.Icon, rectIcon);
            }
        }
        private void DrawCaption(Graphics g)
        {
            if (ClientRectangle.Width == 0 || ClientRectangle.Height == 0)
            {
                return;
            }

            if (DockPane.IsActivated)
            {
                Color startColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.StartColor;
                Color endColor   = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.EndColor;
                LinearGradientMode gradientMode = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.LinearGradientMode;
                using (LinearGradientBrush brush = new LinearGradientBrush(ClientRectangle, startColor, endColor, gradientMode))
                {
                    brush.Blend = ActiveBackColorGradientBlend;
                    g.FillRectangle(brush, ClientRectangle);
                }
                Color borderTop    = startColor.Lerp(Color.White, .7f);
                Color borderBottom = endColor.Lerp(Color.Black, .8f);
                using (Pen pen = new Pen(borderTop))
                {
                    g.DrawLine(pen, 0, 1, ClientRectangle.Width, 1);
                }

                using (Pen pen = new Pen(borderBottom))
                {
                    g.DrawLine(pen, 0, 0, ClientRectangle.Width, 0);
                }

                using (Pen pen = new Pen(borderBottom))
                {
                    g.DrawLine(pen, 0, ClientRectangle.Bottom - 1, ClientRectangle.Width, ClientRectangle.Bottom - 1);
                }
            }
            else
            {
                Color startColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.StartColor;
                Color endColor   = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.EndColor;
                LinearGradientMode gradientMode = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.LinearGradientMode;
                using (LinearGradientBrush brush = new LinearGradientBrush(ClientRectangle, startColor, endColor, gradientMode))
                {
                    g.FillRectangle(brush, ClientRectangle);
                }
                Color borderTop    = startColor.Lerp(Color.White, .7f);
                Color borderBottom = endColor.Lerp(Color.Black, .8f);
                using (Pen pen = new Pen(borderTop))
                {
                    g.DrawLine(pen, 0, 1, ClientRectangle.Width, 1);
                }

                using (Pen pen = new Pen(borderBottom))
                {
                    g.DrawLine(pen, 0, 0, ClientRectangle.Width, 0);
                }

                using (Pen pen = new Pen(borderBottom))
                {
                    g.DrawLine(pen, 0, ClientRectangle.Bottom - 1, ClientRectangle.Width, ClientRectangle.Bottom - 1);
                }
            }

            Rectangle rectCaption = ClientRectangle;

            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 + 5;
            rectDotsStrip.Width -= textLength + 8;
            rectDotsStrip.Height = ClientRectangle.Height;

            Color dotsColor;

            if (DockPane.IsActivated)
            {
                dotsColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.EndColor.Lerp(Color.Black, .8f);
            }
            else
            {
                dotsColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.EndColor.Lerp(Color.Black, .3f);
            }


            DrawDotsStrip(g, rectDotsStrip, dotsColor);
        }
Esempio n. 22
0
        private void DrawCaption(Graphics g)
        {
            if (ClientRectangle.Width == 0 || ClientRectangle.Height == 0)
            {
                return;
            }

            Rectangle rect = ClientRectangle;
            Color     captionColor;
            var       theme = (VS2012LightTheme)DockPane.DockPanel.Theme;

            if (DockPane.IsActivated || theme.ForceActiveCaptionColor)
            {
                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;

            //CHANGED: Make the dots extend properly when the close button is not showing.
            //rectCaptionText.Width -= ButtonGapLeft + ButtonClose.Width + ButtonGapRight;
            rectCaptionText.Width -= ButtonGapLeft + ButtonGapRight;
            if (CloseButtonVisible)
            {
                rectCaptionText.Width -= ButtonClose.Width;
            }

            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 || theme.ForceActiveCaptionColor)
            {
                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 || theme.ForceActiveCaptionColor)
            {
                dotsColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.EndColor;
            }
            else
            {
                dotsColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.EndColor;
            }

            DrawDotsStrip(g, rectDotsStrip, dotsColor);
        }
Esempio n. 23
0
        private void DrawCaption(Graphics g)
        {
            if (ClientRectangle.Width == 0 || ClientRectangle.Height == 0)
            {
                return;
            }

            if (DockPane.IsActivated)
            {
                Color startColor = DockPane.DockPanel.Theme.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.StartColor;
                Color endColor   = DockPane.DockPanel.Theme.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.EndColor;
                LinearGradientMode gradientMode = DockPane.DockPanel.Theme.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.LinearGradientMode;
                ClientRectangle.SafelyDrawLinearGradient(startColor, endColor, gradientMode, g, ActiveBackColorGradientBlend);
            }
            else
            {
                Color startColor = DockPane.DockPanel.Theme.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.StartColor;
                Color endColor   = DockPane.DockPanel.Theme.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.EndColor;
                LinearGradientMode gradientMode = DockPane.DockPanel.Theme.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.LinearGradientMode;
                ClientRectangle.SafelyDrawLinearGradient(startColor, endColor, gradientMode, g);
            }

            Rectangle rectCaption = ClientRectangle;

            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;


            if (DockPane.ActiveContent != null)
            {
                var icon = DockPane.ActiveContent.DockHandler.Icon;
                if (icon != null && DockPane.DockPanel.ShowDocumentIcon)
                {
                    int offset = (rectCaption.Height - 16) / 2;
                    g.DrawIcon(icon, new Rectangle(offset, offset, 16, 16));
                    rectCaptionText.X     += 16 + offset;
                    rectCaptionText.Width -= 16 + offset;
                }
            }


            Color colorText;

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

            TextRenderer.DrawText(g, DockPane.CaptionText, TextFont, DrawHelper.RtlTransform(this, rectCaptionText), colorText, TextFormat);
        }
Esempio n. 24
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.ToolTitleActiveBG;
            }
            else
            {
                captionColor = DockPane.DockPanel.Skin.ToolTitleLostFocusBG;
            }

            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.ToolTitleActiveFG;
            }
            else
            {
                colorText = DockPane.DockPanel.Skin.ToolTitleLostFocusFG;
            }

            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.ToolTitleDotActive;
            }
            else
            {
                dotsColor = DockPane.DockPanel.Skin.ToolTitleDotLostFocus;
            }

            DrawDotsStrip(g, rectDotsStrip, dotsColor);
        }
Esempio n. 25
0
        private void DrawTab_Document(Graphics g, TabVS2005 tab, Rectangle rect)
        {
            if (tab.TabWidth == 0)
            {
                return;
            }

            Rectangle rectIcon = new Rectangle(
                rect.X + DocumentIconGapLeft,
                rect.Y + rect.Height - 1 - DocumentIconGapBottom - DocumentIconHeight,
                DocumentIconWidth, DocumentIconHeight);
            Rectangle rectText = rectIcon;

            if (DockPane.DockPanel.ShowDocumentIcon)
            {
                rectText.X    += rectIcon.Width + DocumentIconGapRight;
                rectText.Y     = rect.Y;
                rectText.Width = rect.Width - rectIcon.Width - DocumentIconGapLeft -
                                 DocumentIconGapRight - DocumentTextGapRight;
                rectText.Height = rect.Height;
            }
            else
            {
                rectText.Width = rect.Width - DocumentIconGapLeft - DocumentTextGapRight;
            }

            Rectangle rectTab = DrawHelper.RtlTransform(this, rect);

            rectText = DrawHelper.RtlTransform(this, rectText);
            rectIcon = DrawHelper.RtlTransform(this, rectIcon);
            GraphicsPath path = GetTabOutline(tab, true, false);

            if (DockPane.ActiveContent == tab.Content)
            {
                using (LinearGradientBrush gradientBrush = new LinearGradientBrush(path.GetBounds(), tab.Content.TabColor1, tab.Content.TabColor2, 270f))
                {
                    g.FillPath(gradientBrush, path);
                }
                g.DrawPath(PenDocumentTabActiveBorder, path);

                if (DockPane.IsActiveDocumentPane)
                {
                    TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, BoldFont, rectText, ColorDocumentActiveText, DocumentTextFormat);
                }
                else
                {
                    TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, TextFont, rectText, ColorDocumentActiveText, DocumentTextFormat);
                }
            }
            else
            {
                using (LinearGradientBrush gradientBrush = new LinearGradientBrush(path.GetBounds(), ControlPaint.Light(tab.Content.TabColor1), ControlPaint.Light(tab.Content.TabColor2), 270f))
                {
                    g.FillPath(gradientBrush, path);
                }
                using (Pen pen = new Pen(SystemColors.InactiveBorder, .5f))
                {
                    g.DrawPath(pen, path);
                }
                TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, TextFont, rectText, ColorDocumentInactiveText, DocumentTextFormat);
            }

            if (rectTab.Contains(rectIcon) && DockPane.DockPanel.ShowDocumentIcon)
            {
                g.DrawIcon(tab.Content.DockHandler.Icon, rectIcon);
            }
        }