Exemplo n.º 1
0
        private Rectangle GetTabRectangle_ToolWindow(int index)
        {
            Rectangle tabStripRectangle = this.TabStripRectangle;
            TabVS2005 bvs = (TabVS2005)base.Tabs[index];

            return(new Rectangle(bvs.TabX, tabStripRectangle.Y, bvs.TabWidth, tabStripRectangle.Height));
        }
Exemplo n.º 2
0
        private Rectangle GetTabRectangle_ToolWindow(int index)
        {
            Rectangle rectTabStrip = this.TabStripRectangle;
            TabVS2005 tab          = (TabVS2005)(this.Tabs[index]);

            return(new Rectangle(tab.TabX, rectTabStrip.Y, tab.TabWidth, rectTabStrip.Height));
        }
Exemplo n.º 3
0
        protected override void OnMouseHover(EventArgs e)
        {
            int    num     = this.HitTest(base.PointToClient(Control.MousePosition));
            string caption = string.Empty;

            base.OnMouseHover(e);
            if (num != -1)
            {
                TabVS2005 bvs = base.Tabs[num] as TabVS2005;
                if (!string.IsNullOrEmpty(bvs.Content.DockHandler.ToolTipText))
                {
                    caption = bvs.Content.DockHandler.ToolTipText;
                }
                else if (bvs.MaxWidth > bvs.TabWidth)
                {
                    caption = bvs.Content.DockHandler.TabText;
                }
            }
            if (this.m_toolTip.GetToolTip(this) != caption)
            {
                this.m_toolTip.Active = false;
                this.m_toolTip.SetToolTip(this, caption);
                this.m_toolTip.Active = true;
            }
            base.ResetMouseEventArgs();
        }
Exemplo n.º 4
0
        private bool CalculateDocumentTab(Rectangle rectTabStrip, ref int x, int index)
        {
            bool overflow = false;

            TabVS2005 tab = Tabs[index] as TabVS2005;

            tab.MaxWidth = GetMaxTabWidth(index);
            int width = Math.Min(tab.MaxWidth, DocumentTabMaxWidth);

            if (x + width < rectTabStrip.Right || index == StartDisplayingTab)
            {
                tab.TabX         = x;
                tab.TabWidth     = width;
                EndDisplayingTab = index;
            }
            else
            {
                tab.TabX     = 0;
                tab.TabWidth = 0;
                overflow     = true;
            }
            x += width;

            return(overflow);
        }
Exemplo n.º 5
0
        private Rectangle GetTabRectangle_Document(int index)
        {
            Rectangle rectTabStrip = TabStripRectangle;
            TabVS2005 tab          = (TabVS2005)Tabs[index];

            return(new Rectangle(tab.TabX, rectTabStrip.Y + DocumentTabGapTop, tab.TabWidth, rectTabStrip.Height - DocumentTabGapTop));
        }
Exemplo n.º 6
0
        protected override void OnMouseHover(EventArgs e)
        {
            int    index   = HitTest(PointToClient(Control.MousePosition));
            string toolTip = string.Empty;

            base.OnMouseHover(e);

            if (index != -1)
            {
                TabVS2005 tab = Tabs[index] as TabVS2005;
                if (!String.IsNullOrEmpty(tab.Content.DockHandler.ToolTipText))
                {
                    toolTip = tab.Content.DockHandler.ToolTipText;
                }
                else if (tab.MaxWidth > tab.TabWidth)
                {
                    toolTip = tab.Content.DockHandler.TabText;
                }
            }

            if (m_toolTip.GetToolTip(this) != toolTip)
            {
                m_toolTip.Active = false;
                m_toolTip.SetToolTip(this, toolTip);
                m_toolTip.Active = true;
            }

            // requires further tracking of mouse hover behavior,
            ResetMouseEventArgs();
        }
        private Rectangle GetTabRectangle(TabVS2005 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 = rectTabStrip.Y +
                    (dockState == DockState.DockTopAutoHide || dockState == DockState.DockRightAutoHide ?
                     0 : 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)));
            }
        }
Exemplo n.º 8
0
        private Rectangle GetTabRectangle_Document(int index)
        {
            Rectangle tabStripRectangle = this.TabStripRectangle;
            TabVS2005 bvs = (TabVS2005)base.Tabs[index];

            return(new Rectangle(bvs.TabX, tabStripRectangle.Y + DocumentTabGapTop, bvs.TabWidth,
                                 tabStripRectangle.Height - DocumentTabGapTop));
        }
Exemplo n.º 9
0
        private void DrawTab(Graphics g, TabVS2005 tab)
        {
            Rectangle rectTabOrigin = GetTabRectangle(tab);

            if (rectTabOrigin.IsEmpty)
            {
                return;
            }

            DockState    dockState = tab.Content.DockHandler.DockState;
            IDockContent content   = tab.Content;

            GraphicsPath path = GetTabOutline(tab, false, true);

            g.FillPath(BrushTabBackground, path);
            g.DrawPath(PenTabBorder, path);

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

            g.Transform = MatrixIdentity;

            // Draw the icon
            Rectangle rectImage = rectTabOrigin;

            rectImage.X += ImageGapLeft;
            rectImage.Y += ImageGapTop;
            int imageHeight = rectTabOrigin.Height - ImageGapTop - ImageGapBottom;
            int imageWidth  = ImageWidth;

            if (imageHeight > ImageHeight)
            {
                imageWidth = ImageWidth * (imageHeight / ImageHeight);
            }
            rectImage.Height = imageHeight;
            rectImage.Width  = imageWidth;
            rectImage        = GetTransformedRectangle(dockState, rectImage);
            g.DrawIcon(((Form)content).Icon, RtlTransform(rectImage, dockState));

            // Draw the text
            Rectangle rectText = rectTabOrigin;

            rectText.X     += ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft;
            rectText.Width -= ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft;
            rectText        = RtlTransform(GetTransformedRectangle(dockState, rectText), dockState);
            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;
        }
Exemplo n.º 10
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)
            {
                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);
            }
        }
Exemplo n.º 11
0
 private GraphicsPath GetTabOutline(TabVS2005 tab, bool transformed, bool rtlTransform)
 {
     DockState dockState = tab.Content.DockHandler.DockState;
     Rectangle rectTab = this.GetTabRectangle(tab, transformed);
     if(rtlTransform){
         rectTab = this.RtlTransform(rectTab, dockState);
     }
     bool upTab = (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockBottomAutoHide);
     DrawHelper.GetRoundedCornerTab(GraphicsPath, rectTab, upTab);
     return GraphicsPath;
 }
 private void DrawTab(Graphics g, TabVS2005 tab, Rectangle rect)
 {
     if (Appearance == DockPane.AppearanceStyle.ToolWindow)
     {
         DrawTab_ToolWindow(g, tab, rect);
     }
     else
     {
         DrawTab_Document(g, tab, rect);
     }
 }
Exemplo n.º 13
0
 private System.Drawing.Drawing2D.GraphicsPath GetTabOutline(TabVS2005 tab, bool transformed, bool rtlTransform)
 {
     DockState dockState = tab.Content.DockHandler.DockState;
     Rectangle tabRectangle = this.GetTabRectangle(tab, transformed);
     if (rtlTransform)
     {
         tabRectangle = this.RtlTransform(tabRectangle, dockState);
     }
     bool upCorner = (dockState == DockState.DockLeftAutoHide) || (dockState == DockState.DockBottomAutoHide);
     DrawHelper.GetRoundedCornerTab(GraphicsPath, tabRectangle, upCorner);
     return GraphicsPath;
 }
Exemplo n.º 14
0
 private void DrawTab_Document(Graphics g, TabVS2005 tab, Rectangle rect)
 {
     if (tab.TabWidth != 0)
     {
         Rectangle rectangle = new Rectangle(rect.X + DocumentIconGapLeft,
                                             (((rect.Y + rect.Height) - 1) - DocumentIconGapBottom) - DocumentIconHeight, DocumentIconWidth,
                                             DocumentIconHeight);
         Rectangle rectangle2 = rectangle;
         if (base.DockPane.DockPanel.ShowDocumentIcon)
         {
             rectangle2.X    += rectangle.Width + DocumentIconGapRight;
             rectangle2.Y     = rect.Y;
             rectangle2.Width = (((rect.Width - rectangle.Width) - DocumentIconGapLeft) - DocumentIconGapRight) -
                                DocumentTextGapRight;
             rectangle2.Height = rect.Height;
         }
         else
         {
             rectangle2.Width = (rect.Width - DocumentIconGapLeft) - DocumentTextGapRight;
         }
         Rectangle rectangle3 = DrawHelper.RtlTransform(this, rect);
         rectangle2 = DrawHelper.RtlTransform(this, rectangle2);
         rectangle  = DrawHelper.RtlTransform(this, rectangle);
         System.Drawing.Drawing2D.GraphicsPath path = this.GetTabOutline(tab, true, false);
         if (base.DockPane.ActiveContent == tab.Content)
         {
             g.FillPath(BrushDocumentActiveBackground, path);
             g.DrawPath(PenDocumentTabActiveBorder, path);
             if (base.DockPane.IsActiveDocumentPane)
             {
                 TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, this.BoldFont, rectangle2,
                                       ColorDocumentActiveText, this.DocumentTextFormat);
             }
             else
             {
                 TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, TextFont, rectangle2,
                                       ColorDocumentActiveText, this.DocumentTextFormat);
             }
         }
         else
         {
             g.FillPath(BrushDocumentInactiveBackground, path);
             g.DrawPath(PenDocumentTabInactiveBorder, path);
             TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, TextFont, rectangle2,
                                   ColorDocumentInactiveText, this.DocumentTextFormat);
         }
         if (rectangle3.Contains(rectangle) && base.DockPane.DockPanel.ShowDocumentIcon)
         {
             g.DrawIcon(tab.Content.DockHandler.Icon, rectangle);
         }
     }
 }
        private GraphicsPath GetTabOutline(TabVS2005 tab, bool transformed, bool rtlTransform)
        {
            var dockState = tab.Content.DockHandler.DockState;
            var rectTab   = GetTabRectangle(tab, transformed);

            if (rtlTransform)
            {
                rectTab = RtlTransform(rectTab, dockState);
            }
            var upTab = dockState == DockState.DockLeftAutoHide || dockState == DockState.DockBottomAutoHide;

            DrawHelper.GetRoundedCornerTab(GraphicsPath, rectTab, upTab);

            return(GraphicsPath);
        }
Exemplo n.º 16
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);
            }
        }
Exemplo n.º 17
0
        private bool EnsureDocumentTabVisible(IDockContent content, bool repaint)
        {
            int       index = base.Tabs.IndexOf(content);
            TabVS2005 bvs   = base.Tabs[index] as TabVS2005;

            if (bvs.TabWidth != 0)
            {
                return(false);
            }
            this.StartDisplayingTab = index;
            if (repaint)
            {
                base.Invalidate();
            }
            return(true);
        }
Exemplo n.º 18
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);
            }
        }
Exemplo n.º 19
0
        private void DrawTab(Graphics g, TabVS2005 tab)
        {
            Rectangle tabRectangle = GetTabRectangle(tab);

            if (!tabRectangle.IsEmpty)
            {
                DockState          dockState          = tab.Content.DockHandler.DockState;
                IDockContent       content            = tab.Content;
                GraphicsPath       tabOutline         = GetTabOutline(tab, transformed: false, rtlTransform: true);
                Color              startColor         = base.DockPanel.Skin.AutoHideStripSkin.TabGradient.StartColor;
                Color              endColor           = base.DockPanel.Skin.AutoHideStripSkin.TabGradient.EndColor;
                LinearGradientMode linearGradientMode = base.DockPanel.Skin.AutoHideStripSkin.TabGradient.LinearGradientMode;
                g.FillPath(new LinearGradientBrush(tabRectangle, startColor, endColor, linearGradientMode), tabOutline);
                g.DrawPath(PenTabBorder, tabOutline);
                Matrix transform = g.Transform;
                g.Transform = MatrixIdentity;
                Rectangle rect = tabRectangle;
                rect.X += ImageGapLeft;
                rect.Y += ImageGapTop;
                int num  = tabRectangle.Height - ImageGapTop - ImageGapBottom;
                int num2 = ImageWidth;
                if (num > ImageHeight)
                {
                    num2 = ImageWidth * (num / ImageHeight);
                }
                rect.Height = num;
                rect.Width  = num2;
                rect        = GetTransformedRectangle(dockState, rect);
                g.DrawIcon(((Form)content).Icon, RtlTransform(rect, dockState));
                Rectangle rect2 = tabRectangle;
                rect2.X     += ImageGapLeft + num2 + ImageGapRight + TextGapLeft;
                rect2.Width -= ImageGapLeft + num2 + ImageGapRight + TextGapLeft;
                rect2        = RtlTransform(GetTransformedRectangle(dockState, rect2), dockState);
                Color textColor = base.DockPanel.Skin.AutoHideStripSkin.TabGradient.TextColor;
                if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide)
                {
                    g.DrawString(content.DockHandler.TabText, TextFont, new SolidBrush(textColor), rect2, StringFormatTabVertical);
                }
                else
                {
                    g.DrawString(content.DockHandler.TabText, TextFont, new SolidBrush(textColor), rect2, StringFormatTabHorizontal);
                }
                g.Transform = transform;
            }
        }
Exemplo n.º 20
0
 private Rectangle GetTabRectangle(TabVS2005 tab, bool transformed)
 {
     DockState dockState = tab.Content.DockHandler.DockState;
     Rectangle logicalTabStripRectangle = this.GetLogicalTabStripRectangle(dockState);
     if (logicalTabStripRectangle.IsEmpty)
     {
         return Rectangle.Empty;
     }
     int tabX = tab.TabX;
     int y = logicalTabStripRectangle.Y + (((dockState == DockState.DockTopAutoHide) || (dockState == DockState.DockRightAutoHide)) ? 0 : TabGapTop);
     int tabWidth = tab.TabWidth;
     int height = logicalTabStripRectangle.Height - TabGapTop;
     if (!transformed)
     {
         return new Rectangle(tabX, y, tabWidth, height);
     }
     return this.GetTransformedRectangle(dockState, new Rectangle(tabX, y, tabWidth, height));
 }
        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);
                }
            }
        }
Exemplo n.º 22
0
        private void DrawTab(Graphics g, TabVS2005 tab)
        {
            Rectangle tabRectangle = this.GetTabRectangle(tab);

            if (!tabRectangle.IsEmpty)
            {
                DockState    dockState = tab.Content.DockHandler.DockState;
                IDockContent content   = tab.Content;
                System.Drawing.Drawing2D.GraphicsPath path = this.GetTabOutline(tab, false, true);
                g.FillPath(BrushTabBackground, path);
                g.DrawPath(PenTabBorder, path);
                Matrix transform = g.Transform;
                g.Transform = MatrixIdentity;
                Rectangle rect = tabRectangle;
                rect.X += ImageGapLeft;
                rect.Y += ImageGapTop;
                int num        = (tabRectangle.Height - ImageGapTop) - ImageGapBottom;
                int imageWidth = ImageWidth;
                if (num > ImageHeight)
                {
                    imageWidth = ImageWidth * (num / ImageHeight);
                }
                rect.Height = num;
                rect.Width  = imageWidth;
                rect        = this.GetTransformedRectangle(dockState, rect);
                g.DrawIcon(((Form)content).Icon, this.RtlTransform(rect, dockState));
                Rectangle rectangle3 = tabRectangle;
                rectangle3.X     += ((ImageGapLeft + imageWidth) + ImageGapRight) + TextGapLeft;
                rectangle3.Width -= ((ImageGapLeft + imageWidth) + ImageGapRight) + TextGapLeft;
                rectangle3        = this.RtlTransform(this.GetTransformedRectangle(dockState, rectangle3), dockState);
                if ((dockState == DockState.DockLeftAutoHide) || (dockState == DockState.DockRightAutoHide))
                {
                    g.DrawString(content.DockHandler.TabText, TextFont, BrushTabText, rectangle3,
                                 this.StringFormatTabVertical);
                }
                else
                {
                    g.DrawString(content.DockHandler.TabText, TextFont, BrushTabText, rectangle3,
                                 this.StringFormatTabHorizontal);
                }
                g.Transform = transform;
            }
        }
Exemplo n.º 23
0
        private void DrawTab_ToolWindow(Graphics g, TabVS2005 tab, Rectangle rect)
        {
            Rectangle rectangle = new Rectangle(rect.X + ToolWindowImageGapLeft,
                                                (((rect.Y + rect.Height) - 1) - ToolWindowImageGapBottom) - ToolWindowImageHeight, ToolWindowImageWidth,
                                                ToolWindowImageHeight);
            Rectangle rectangle2 = rectangle;

            rectangle2.X    += rectangle.Width + ToolWindowImageGapRight;
            rectangle2.Width = (((rect.Width - rectangle.Width) - ToolWindowImageGapLeft) - ToolWindowImageGapRight) -
                               ToolWindowTextGapRight;
            Rectangle rectangle3 = DrawHelper.RtlTransform(this, rect);

            rectangle2 = DrawHelper.RtlTransform(this, rectangle2);
            rectangle  = DrawHelper.RtlTransform(this, rectangle);
            System.Drawing.Drawing2D.GraphicsPath path = this.GetTabOutline(tab, true, false);
            if (base.DockPane.ActiveContent == tab.Content)
            {
                g.FillPath(BrushToolWindowActiveBackground, path);
                g.DrawPath(PenToolWindowTabBorder, path);
                TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, TextFont, rectangle2,
                                      ColorToolWindowActiveText, this.ToolWindowTextFormat);
            }
            else
            {
                if (base.Tabs.IndexOf(base.DockPane.ActiveContent) != (base.Tabs.IndexOf(tab) + 1))
                {
                    Point point  = new Point(rect.Right, rect.Top + ToolWindowTabSeperatorGapTop);
                    Point point2 = new Point(rect.Right, rect.Bottom - ToolWindowTabSeperatorGapBottom);
                    g.DrawLine(PenToolWindowTabBorder, DrawHelper.RtlTransform(this, point),
                               DrawHelper.RtlTransform(this, point2));
                }
                TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, TextFont, rectangle2,
                                      ColorToolWindowInactiveText, this.ToolWindowTextFormat);
            }
            if (rectangle3.Contains(rectangle))
            {
                g.DrawIcon(tab.Content.DockHandler.Icon, rectangle);
            }
        }
Exemplo n.º 24
0
        private bool CalculateDocumentTab(Rectangle rectTabStrip, ref int x, int index)
        {
            bool      flag = false;
            TabVS2005 bvs  = base.Tabs[index] as TabVS2005;

            bvs.MaxWidth = this.GetMaxTabWidth(index);
            int num = Math.Min(bvs.MaxWidth, DocumentTabMaxWidth);

            if (((x + num) < rectTabStrip.Right) || (index == this.StartDisplayingTab))
            {
                bvs.TabX              = x;
                bvs.TabWidth          = num;
                this.EndDisplayingTab = index;
            }
            else
            {
                bvs.TabX     = 0;
                bvs.TabWidth = 0;
                flag         = true;
            }
            x += num;
            return(flag);
        }
Exemplo n.º 25
0
        private void DrawTabStrip_Document(Graphics g)
        {
            int count = base.Tabs.Count;

            if (count != 0)
            {
                Rectangle tabStripRectangle = this.TabStripRectangle;
                Rectangle tabsRectangle     = this.TabsRectangle;
                Rectangle empty             = Rectangle.Empty;
                TabVS2005 tab = null;
                g.SetClip(DrawHelper.RtlTransform(this, tabsRectangle));
                for (int i = 0; i < count; i++)
                {
                    empty = this.GetTabRectangle(i);
                    if (base.Tabs[i].Content == base.DockPane.ActiveContent)
                    {
                        tab = base.Tabs[i] as TabVS2005;
                    }
                    else if (empty.IntersectsWith(tabsRectangle))
                    {
                        this.DrawTab(g, base.Tabs[i] as TabVS2005, empty);
                    }
                }
                g.SetClip(tabStripRectangle);
                g.DrawLine(PenDocumentTabActiveBorder, tabStripRectangle.Left, tabStripRectangle.Bottom - 1,
                           tabStripRectangle.Right, tabStripRectangle.Bottom - 1);
                g.SetClip(DrawHelper.RtlTransform(this, tabsRectangle));
                if (tab != null)
                {
                    empty = this.GetTabRectangle(base.Tabs.IndexOf(tab));
                    if (empty.IntersectsWith(tabsRectangle))
                    {
                        this.DrawTab(g, tab, empty);
                    }
                }
            }
        }
Exemplo n.º 26
0
        private void DrawTab(Graphics g, TabVS2005 tab)
        {
            Rectangle rectTabOrigin = GetTabRectangle(tab);

            if (rectTabOrigin.IsEmpty)
            {
                return;
            }

            DockState    dockState = tab.Content.DockHandler.DockState;
            IDockContent content   = tab.Content;

            GraphicsPath       path         = GetTabOutline(tab, false, true);
            Color              startColor   = DockPanel.Theme.Skin.AutoHideStripSkin.TabGradient.StartColor;
            Color              endColor     = DockPanel.Theme.Skin.AutoHideStripSkin.TabGradient.EndColor;
            LinearGradientMode gradientMode = DockPanel.Theme.Skin.AutoHideStripSkin.TabGradient.LinearGradientMode;

            using (LinearGradientBrush brushPath = new LinearGradientBrush(rectTabOrigin, startColor, endColor, gradientMode))
            {
                g.FillPath(brushPath, path);
            }

            g.DrawPath(PenTabBorder, path);

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

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

                if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide)
                {
                    // The DockState is DockLeftAutoHide or DockRightAutoHide, so rotate the image 90 degrees to the right.
                    Rectangle rectTransform  = RtlTransform(rectImage, dockState);
                    Point[]   rotationPoints =
                    {
                        new Point(rectTransform.X + rectTransform.Width, rectTransform.Y),
                        new Point(rectTransform.X + rectTransform.Width, rectTransform.Y + rectTransform.Height),
                        new Point(rectTransform.X,                       rectTransform.Y)
                    };

                    using (Icon rotatedIcon = new Icon(((Form)content).Icon, 16, 16))
                    {
                        g.DrawImage(rotatedIcon.ToBitmap(), rotationPoints);
                    }
                }
                else
                {
                    // Draw the icon normally without any rotation.
                    g.DrawIcon(((Form)content).Icon, RtlTransform(rectImage, dockState));
                }

                // Draw the text
                Rectangle rectText = rectTabOrigin;
                rectText.X     += ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft;
                rectText.Width -= ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft;
                rectText        = RtlTransform(GetTransformedRectangle(dockState, rectText), dockState);

                Color textColor = DockPanel.Theme.Skin.AutoHideStripSkin.TabGradient.TextColor;

                if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide)
                {
                    g.DrawString(content.DockHandler.TabText, TextFont, new SolidBrush(textColor), rectText, StringFormatTabVertical);
                }
                else
                {
                    g.DrawString(content.DockHandler.TabText, TextFont, new SolidBrush(textColor), rectText, StringFormatTabHorizontal);
                }

                // Set rotate back
                g.Transform = matrixRotate;
            }
        }
Exemplo n.º 27
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(PenToolWindowTabActiveBorder, path);

                // NICK: eliminate line between tab and content
                RectangleF r = path.GetBounds();
                Color color = PluginCore.PluginBase.MainForm.GetThemeColor("VS2005DockPaneStrip.ToolSeparatorColor");
                if (color == Color.Empty) color = Color.FromArgb(240, 239, 243);
                using (Pen pen = new Pen(color)) 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);
        }
Exemplo n.º 28
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;

            String tabStyle = PluginCore.PluginBase.MainForm.GetThemeValue("VS2005DockPaneStrip.TabStyle");

            // Adjust text
            double scale = ScaleHelper.GetScale();
            if (scale >= 1.5)
            {
                String tabSize = PluginCore.PluginBase.MainForm.GetThemeValue("VS2005DockPaneStrip.TabSize");
                if (tabSize == "Default") rectText.Y += ScaleHelper.Scale(1);
            }
            else rectText.Y += ScaleHelper.Scale(2);
            if (Font.SizeInPoints <= 8F) rectText.Y -= ScaleHelper.Scale(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);

            Color stripColor = tab.Content.DockHandler.TabColor;
            if (stripColor != Color.Transparent)
            {
                Color temp = PluginCore.PluginBase.MainForm.GetThemeColor("VS2005DockPaneStrip.TabStripColor");
                if (temp != Color.Empty) stripColor = temp;
            }

            if (DockPane.ActiveContent == tab.Content)
            {
                if (tabStyle == "Rect") g.FillRectangle(BrushDocumentActiveBackground, rectTab);
                else g.FillPath(BrushDocumentActiveBackground, path);

                // Change by Mika: add color strip to tabs
                SolidBrush stripBrush = new SolidBrush(stripColor);
                Rectangle stripRect = rectTab;
                stripRect.X = stripRect.X + stripRect.Width - 2;
                stripRect.Height -= 1;
                stripRect.Width = 2;
                stripRect.Y += 1;
                g.FillRectangle(stripBrush, stripRect);

                if (tabStyle == "Rect") g.DrawRectangle(PenDocumentTabActiveBorder, rectTab);
                else g.DrawPath(PenDocumentTabActiveBorder, path);

                Color sepColor = PluginCore.PluginBase.MainForm.GetThemeColor("VS2005DockPaneStrip.TabSeparatorColor");

                // CHANGED to eliminate line between selected tab and content - NICK
                RectangleF r = path.GetBounds();
                float right = stripColor == Color.Transparent ? r.Right - 1 : r.Right - 3;

                // Choose color
                if (sepColor == Color.Empty)
                {
                    if (PluginCore.PluginBase.Settings.UseSystemColors)
                    {
                        sepColor = SystemColors.ControlLight;
                    }
                    else sepColor = Color.FromArgb(240, 239, 243);
                }
                
                // Draw separator
                using (Pen pen = new Pen(sepColor))
                {
                    if (tabStyle == "Rect") g.DrawLine(pen, rectTab.Left + 2, rectTab.Bottom - 1, right, rectTab.Bottom - 1);
                    else g.DrawLine(pen, r.Left + 2, r.Bottom - 1, right, 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);

                // Choose color
                Color color = PluginCore.PluginBase.MainForm.GetThemeColor("VS2005DockPaneStrip.DocInactiveBackColor");
                if (color != Color.Empty)
                {
                    tabBrush = new SolidBrush(color);
                }

                //g.FillPath(BrushDocumentInactiveBackground, path);
                if (tabStyle == "Rect") g.FillRectangle(tabBrush, rectTab);
                else g.FillPath(tabBrush, path);

                // Change by Mika: add color strip to tabs
                SolidBrush stripBrush = new SolidBrush(stripColor);
                Rectangle stripRect = rectTab;
                stripRect.X = stripRect.X + stripRect.Width - 2;
                stripRect.Height -= 2;
                stripRect.Width = 2;
                stripRect.Y += 1;
                g.FillRectangle(stripBrush, stripRect);

                if (tabStyle == "Rect") g.DrawRectangle(PenDocumentTabInactiveBorder, rectTab);
                else 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);
        }
Exemplo n.º 29
0
        private void DrawTab(Graphics g, TabVS2005 tab)
        {
            Rectangle rectTabOrigin = GetTabRectangle(tab);

            //if (rectTabOrigin.IsEmpty || rectTabOrigin.Height == 0 || rectTabOrigin.Width == 0)
            //    return;
            if (rectTabOrigin.IsEmpty)
            {
                return;
            }
            DockState    dockState = tab.Content.DockHandler.DockState;
            IDockContent content   = tab.Content;

            GraphicsPath path = GetTabOutline(tab, false, true);

            Color startColor = DockPanel.Skin.AutoHideStripSkin.TabGradient.StartColor;
            Color endColor   = DockPanel.Skin.AutoHideStripSkin.TabGradient.EndColor;
            LinearGradientMode gradientMode = DockPanel.Skin.AutoHideStripSkin.TabGradient.LinearGradientMode;

            g.FillPath(new LinearGradientBrush(rectTabOrigin, startColor, endColor, gradientMode), path);
            g.DrawPath(PenTabBorder, path);

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

            g.Transform = MatrixIdentity;

            // Draw the icon
            Rectangle rectImage = rectTabOrigin;

            rectImage.X += ImageGapLeft;
            rectImage.Y += ImageGapTop;
            int imageHeight = rectTabOrigin.Height - ImageGapTop - ImageGapBottom;
            int imageWidth  = ImageWidth;

            if (imageHeight > ImageHeight)
            {
                imageWidth = ImageWidth * (imageHeight / ImageHeight);
            }
            rectImage.Height = imageHeight;
            rectImage.Width  = imageWidth;
            rectImage        = GetTransformedRectangle(dockState, rectImage);
            g.DrawIcon(((Form)content).Icon, RtlTransform(rectImage, dockState));

            // Draw the text
            Rectangle rectText = rectTabOrigin;

            rectText.X     += ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft;
            rectText.Width -= ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft;
            rectText        = RtlTransform(GetTransformedRectangle(dockState, rectText), dockState);

            Color textColor = DockPanel.Skin.AutoHideStripSkin.TabGradient.TextColor;

            if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide)
            {
                g.DrawString(content.DockHandler.TabText, TextFont, new SolidBrush(textColor), rectText, StringFormatTabVertical);
            }
            else
            {
                g.DrawString(content.DockHandler.TabText, TextFont, new SolidBrush(textColor), rectText, StringFormatTabHorizontal);
            }

            // Set rotate back
            g.Transform = matrixRotate;
        }
Exemplo n.º 30
0
        void DrawTab(System.Drawing.Graphics g, TabVS2005 tab)
        {
            var rectTabOrigin = GetTabRectangle(tab);
            if (rectTabOrigin.IsEmpty)
                return;

            var dockState = tab.Content.DockHandler.DockState;
            var content = tab.Content;

            var path = GetTabOutline(tab, false, true);

            var startColor = DockPanel.Skin.AutoHideStripSkin.TabGradient.StartColor;
            var endColor = DockPanel.Skin.AutoHideStripSkin.TabGradient.EndColor;
            var gradientMode = DockPanel.Skin.AutoHideStripSkin.TabGradient.LinearGradientMode;
            g.FillPath(new LinearGradientBrush(rectTabOrigin, startColor, endColor, gradientMode), path);
            g.DrawPath(PenTabBorder, path);

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

            // Draw the icon
            var rectImage = rectTabOrigin;
            rectImage.X += ImageGapLeft;
            rectImage.Y += ImageGapTop;
            var imageHeight = rectTabOrigin.Height - ImageGapTop - ImageGapBottom;
            var imageWidth = ImageWidth;
            if (imageHeight > ImageHeight)
                imageWidth = ImageWidth * (imageHeight / ImageHeight);
            rectImage.Height = imageHeight;
            rectImage.Width = imageWidth;
            rectImage = GetTransformedRectangle(dockState, rectImage);
            g.DrawIcon(((Form)content).Icon, RtlTransform(rectImage, dockState));

            // Draw the text
            var rectText = rectTabOrigin;
            rectText.X += ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft;
            rectText.Width -= ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft;
            rectText = RtlTransform(GetTransformedRectangle(dockState, rectText), dockState);

            var textColor = DockPanel.Skin.AutoHideStripSkin.TabGradient.TextColor;

            if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide)
                g.DrawString(content.DockHandler.TabText, TextFont, new SolidBrush(textColor), rectText, StringFormatTabVertical);
            else
                g.DrawString(content.DockHandler.TabText, TextFont, new SolidBrush(textColor), rectText, StringFormatTabHorizontal);

            // Set rotate back
            g.Transform = matrixRotate;
        }
		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)
			{
                OfficeColorTable colorTable = StyleBuilderFactory.GetOffice2007ColorTable(StyleManager.Style);

                g.FillPath(new SolidBrush(colorTable.TabControlPageHoverColor2), path);
                g.DrawPath(new Pen(colorTable.TabControlBorderColor), path);
                //Modify by Agan 2013-06-09
                    //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));
                    //g.DrawLine(new Pen(Color.Red), 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);
		}
Exemplo n.º 32
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)
            {
                using (LinearGradientBrush brush = new LinearGradientBrush(ClientRectangle, PaletteHelper.ActiveBackColor1, PaletteHelper.ActiveBackColor2, LinearGradientMode.Vertical))
                {
                    brush.Blend = PaletteHelper.ActiveBackColorGradientBlend;
                    g.FillPath(brush, path);
                }
                //g.FillPath(BrushToolWindowActiveBackground, path);
                g.DrawPath(PaletteHelper.PenToolWindowTabBorder, path);
                TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, TextFont, rectText, 
                    PaletteHelper.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(PaletteHelper.PenToolWindowTabBorder, DrawHelper.RtlTransform(this, pt1), DrawHelper.RtlTransform(this, pt2));
                }
                TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, TextFont, rectText, 
                    PaletteHelper.ColorToolWindowInactiveText, ToolWindowTextFormat);
            }

            if (rectTab.Contains(rectIcon))
                g.DrawIcon(tab.Content.DockHandler.Icon, rectIcon);
        }
Exemplo n.º 33
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)
            {
                g.FillPath(BrushDocumentActiveBackground, path);
                g.DrawPath(PenDocumentTabActiveBorder, path);
                if (DockPane.IsActiveDocumentPane) {
                    using (SolidBrush brush = new SolidBrush(ColorDocumentActiveText))
                        g.DrawString(tab.Content.DockHandler.TabText, BoldFont, brush,
                                     rectText, DocumentStringFormat);
                } else {
                    using (SolidBrush brush = new SolidBrush(ColorDocumentActiveText))
                        g.DrawString(tab.Content.DockHandler.TabText, TextFont, brush,
                                     rectText, DocumentStringFormat);
                }
            }
            else
            {
                g.FillPath(BrushDocumentInactiveBackground, path);
                g.DrawPath(PenDocumentTabInactiveBorder, path);
                using (SolidBrush brush = new SolidBrush(ColorDocumentInactiveText))
                    g.DrawString(tab.Content.DockHandler.TabText, TextFont, brush,
                                 rectText, DocumentStringFormat);
            }

            if (rectTab.Contains(rectIcon) && DockPane.DockPanel.ShowDocumentIcon)
                g.DrawIcon(tab.Content.DockHandler.Icon, rectIcon);
        }
		private void DrawTab(Graphics g, TabVS2005 tab)
		{
			Rectangle rectTabOrigin = GetTabRectangle(tab);
			if (rectTabOrigin.IsEmpty)
				return;

			DockState dockState = tab.Content.DockHandler.DockState;
			IDockContent content = tab.Content;

            GraphicsPath path = GetTabOutline(tab, false, true);
            g.FillPath(BrushTabBackground, path);
            g.DrawPath(PenTabBorder, path);

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

			// Draw the icon
			Rectangle rectImage = rectTabOrigin;
			rectImage.X += ImageGapLeft;
			rectImage.Y += ImageGapTop;
			int imageHeight = rectTabOrigin.Height - ImageGapTop - ImageGapBottom;
			int imageWidth = ImageWidth;
			if (imageHeight > ImageHeight)
				imageWidth = ImageWidth * (imageHeight/ImageHeight);
			rectImage.Height = imageHeight;
			rectImage.Width = imageWidth;
			rectImage = GetTransformedRectangle(dockState, rectImage);
			//g.DrawIcon(((Form)content).Icon, RtlTransform(rectImage, dockState));
            if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide)
            {
                // The DockState is DockLeftAutoHide or DockRightAutoHide, so rotate the image 90 degrees to the right. 
                Rectangle rectTransform = RtlTransform(rectImage, dockState);
                Point[] rotationPoints = {  
new Point(rectTransform.X + rectTransform.Width, rectTransform.Y), 
new Point(rectTransform.X + rectTransform.Width, rectTransform.Y + rectTransform.Height),  
new Point(rectTransform.X, rectTransform.Y) };
                using (Icon rotatedIcon = new Icon(((Form)content).Icon, 16, 16))
                {
                    g.DrawImage(rotatedIcon.ToBitmap(), rotationPoints);
                }
            }
            else
            {
                // DockState is DockTopAutoHide or DockBottomAutoHide. 
                g.DrawIcon(((Form)content).Icon, RtlTransform(rectImage, dockState));
            } 

			// Draw the text
			Rectangle rectText = rectTabOrigin;
			rectText.X += ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft;
			rectText.Width -= ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft;
			rectText = RtlTransform(GetTransformedRectangle(dockState, rectText), dockState);
			if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide)
				g.DrawString(content.DockHandler.TabText, TextFont, BrushTabText, rectText, StringFormatTabVertical);
			else
				g.DrawString(content.DockHandler.TabText, TextFont, BrushTabText, rectText, StringFormatTabHorizontal);

			// Set rotate back
			g.Transform = matrixRotate;
		}
Exemplo n.º 35
0
 private void DrawTab(Graphics g, TabVS2005 tab, Rectangle rect)
 {
     if (Appearance == DockPane.AppearanceStyle.ToolWindow)
         DrawTab_ToolWindow(g, tab, rect);
     else
         DrawTab_Document(g, tab, rect);
 }
Exemplo n.º 36
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)
            {
                Color startColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveTabGradient.StartColor;
                Color endColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveTabGradient.EndColor;
                LinearGradientMode gradientMode = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveTabGradient.LinearGradientMode;
                g.FillPath(new LinearGradientBrush(rectTab, startColor, endColor, gradientMode), path);
                g.DrawPath(PenToolWindowTabBorder, path);

                Color textColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveTabGradient.TextColor;
                TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, TextFont, rectText, textColor, ToolWindowTextFormat);
            }
            else
            {
                Color startColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveTabGradient.StartColor;
                Color endColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveTabGradient.EndColor;
                LinearGradientMode gradientMode = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveTabGradient.LinearGradientMode;
                g.FillPath(new LinearGradientBrush(rectTab, startColor, endColor, gradientMode), path);

                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));
                }

                Color textColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveTabGradient.TextColor;
                TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, TextFont, rectText, textColor, ToolWindowTextFormat);
            }

            if (rectTab.Contains(rectIcon))
                g.DrawIcon(new Icon(tab.Content.DockHandler.Icon, new Size(rectIcon.Width, rectIcon.Height)), rectIcon);
        }
Exemplo n.º 37
0
        private void DrawTab(Graphics g, TabVS2005 tab)
        {
            Rectangle rectTabOrigin = GetTabRectangle(tab);

            if (rectTabOrigin.IsEmpty)
            {
                return;
            }

            DockState    dockState = tab.Content.DockHandler.DockState;
            IDockContent content   = tab.Content;

            GraphicsPath path = GetTabOutline(tab, false, true);

            g.FillPath(BrushTabBackground, path);
            g.DrawPath(PenTabBorder, path);

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

            g.Transform = MatrixIdentity;

            // Draw the icon
            Rectangle rectImage = rectTabOrigin;

            rectImage.X += ImageGapLeft;
            rectImage.Y += ImageGapTop;
            int imageHeight = rectTabOrigin.Height - ImageGapTop - ImageGapBottom;
            int imageWidth  = ImageWidth;

            if (imageHeight > ImageHeight)
            {
                imageWidth = ImageWidth * (imageHeight / ImageHeight);
            }
            rectImage.Height = imageHeight;
            rectImage.Width  = imageWidth;
            rectImage        = GetTransformedRectangle(dockState, rectImage);
            //g.DrawIcon(((Form)content).Icon, RtlTransform(rectImage, dockState));
            if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide)
            {
                // The DockState is DockLeftAutoHide or DockRightAutoHide, so rotate the image 90 degrees to the right.
                Rectangle rectTransform  = RtlTransform(rectImage, dockState);
                Point[]   rotationPoints =
                {
                    new Point(rectTransform.X + rectTransform.Width, rectTransform.Y),
                    new Point(rectTransform.X + rectTransform.Width, rectTransform.Y + rectTransform.Height),
                    new Point(rectTransform.X,                       rectTransform.Y)
                };
                using (Icon rotatedIcon = new Icon(((Form)content).Icon, 16, 16))
                {
                    g.DrawImage(rotatedIcon.ToBitmap(), rotationPoints);
                }
            }
            else
            {
                // DockState is DockTopAutoHide or DockBottomAutoHide.
                g.DrawIcon(((Form)content).Icon, RtlTransform(rectImage, dockState));
            }

            // Draw the text
            Rectangle rectText = rectTabOrigin;

            rectText.X     += ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft;
            rectText.Width -= ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft;
            rectText        = RtlTransform(GetTransformedRectangle(dockState, rectText), dockState);
            if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide)
            {
                g.DrawString(content.DockHandler.TabText, TextFont, BrushTabText, rectText, StringFormatTabVertical);
            }
            else
            {
                g.DrawString(content.DockHandler.TabText, TextFont, BrushTabText, rectText, StringFormatTabHorizontal);
            }

            // Set rotate back
            g.Transform = matrixRotate;
        }
		private void DrawTab(Graphics g, TabVS2005 tab)
		{
            OfficeColorTable colorTable = StyleBuilderFactory.GetOffice2007ColorTable(StyleManager.Style);
			Rectangle rectTabOrigin = GetTabRectangle(tab);
			if (rectTabOrigin.IsEmpty)
				return;
            
			DockState dockState = tab.Content.DockHandler.DockState;
			IDockContent content = tab.Content;

            GraphicsPath path = GetTabOutline(tab, false, true);
            //g.FillPath(BrushTabBackground, path);
            //g.FillPath(new SolidBrush(colorTable.TabControlPageBackColor), path);
            g.FillPath(new LinearGradientBrush(rectTabOrigin, colorTable.TabControlPageNormalBackColor1, colorTable.TabControlPageNormalBackColor4, 2), path);
            //g.DrawPath(PenTabBorder, path);//Modify by Agan 2013-06-09
            //g.DrawPath(new Pen(colorTable.TabControlBorderColor), path);
            g.DrawPath(new Pen(colorTable.TabControlBorderColor), path);
            // Set no rotate for drawing icon and text
			Matrix matrixRotate = g.Transform;
			g.Transform = MatrixIdentity;

			// Draw the icon
			Rectangle rectImage = rectTabOrigin;
			rectImage.X += ImageGapLeft;
			rectImage.Y += ImageGapTop;
			int imageHeight = rectTabOrigin.Height - ImageGapTop - ImageGapBottom;
			int imageWidth = ImageWidth;
			if (imageHeight > ImageHeight)
				imageWidth = ImageWidth * (imageHeight/ImageHeight);
			rectImage.Height = imageHeight;
			rectImage.Width = imageWidth;
			rectImage = GetTransformedRectangle(dockState, rectImage);
			g.DrawIcon(((Form)content).Icon, RtlTransform(rectImage, dockState));
		
			// Draw the text
			Rectangle rectText = rectTabOrigin;
			rectText.X += ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft;
			rectText.Width -= ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft;
			rectText = RtlTransform(GetTransformedRectangle(dockState, rectText), dockState);
			if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide)
				g.DrawString(content.DockHandler.TabText, TextFont, BrushTabText, rectText, StringFormatTabVertical);
                //g.DrawString(content.DockHandler.TabText, TextFont, new SolidBrush(colorTable.TabControlBorderColor), rectText, StringFormatTabVertical);
            else
				g.DrawString(content.DockHandler.TabText, TextFont, BrushTabText, rectText, StringFormatTabHorizontal);
                //g.DrawString(content.DockHandler.TabText, TextFont, new SolidBrush(colorTable.TabControlBorderColor), rectText, StringFormatTabHorizontal);

			// Set rotate back
			g.Transform = matrixRotate;
		}
Exemplo n.º 39
0
        private GraphicsPath GetTabOutline(TabVS2005 tab, bool transformed, bool rtlTransform)
        {
            DockState dockState = tab.Content.DockHandler.DockState;
            Rectangle rectTab = GetTabRectangle(tab, transformed);
            if (rtlTransform)
                rectTab = RtlTransform(rectTab, dockState);
            bool upTab = (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockBottomAutoHide);
            DrawHelper.GetRoundedCornerTab(GraphicsPath, rectTab, upTab);

            return GraphicsPath;
        }
Exemplo n.º 40
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);
		}
		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);
            OfficeColorTable colorTable = StyleBuilderFactory.GetOffice2007ColorTable(StyleManager.Style);
            if (DockPane.ActiveContent == tab.Content)
            {
               
                g.FillPath(new SolidBrush(colorTable.TabControlPageHoverColor2), path);
                g.DrawPath(new Pen(colorTable.TabControlBorderColor), path);
                 //g.FillPath(BrushDocumentActiveBackground, path);
                //g.DrawPath(PenDocumentTabActiveBorder, path);//Mark by Agan  2013/06/08
                if (DockPane.IsActiveDocumentPane)
                    //TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, BoldFont, rectText, ColorDocumentActiveText, DocumentTextFormat);
                    TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, BoldFont, rectText, colorTable.TabControlPageTextColor, DocumentTextFormat);
                else
                    //TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, TextFont, rectText, ColorDocumentActiveText, DocumentTextFormat);
                    TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, TextFont, rectText, colorTable.TabControlPageTextColor, DocumentTextFormat);
            }
            else
            {
                g.FillPath(new SolidBrush(colorTable.TabControlPageBackColor), path);
                g.DrawPath(new Pen(colorTable.TabControlBorderColor), path);
                
                //Modify by Agan 2013/06/08
                //g.FillPath(BrushDocumentInactiveBackground, path);
                //g.DrawPath(PenDocumentTabInactiveBorder, path);

                //TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, TextFont, rectText, ColorDocumentInactiveText, DocumentTextFormat);
                TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, TextFont, rectText, colorTable.TabControlPageTextColor, DocumentTextFormat);
            }

            if (rectTab.Contains(rectIcon) && DockPane.DockPanel.ShowDocumentIcon)
                g.DrawIcon(tab.Content.DockHandler.Icon, rectIcon);
        }
Exemplo n.º 42
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 + 1,
                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;
            }
            Font fnt = TextFont;
            if (DockPane.IsActiveDocumentPane)
                fnt = BoldFont;
            rectText.Y = rect.Y + Convert.ToInt32((rect.Height - fnt.Height) / 2) - 1;
            rectText.Height = fnt.Height + 1;
            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, TextFont, rectText, ColorDocumentActiveText, DocumentTextFormat);
            }
            else
            {
                g.FillPath(BrushDocumentInactiveBackground, path);
                g.DrawPath(PenDocumentTabInactiveBorder, 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);
        }
        private void DrawTab(Graphics g, TabVS2005 tab)
        {
            Rectangle rectTabOrigin = GetTabRectangle(tab);
            if (rectTabOrigin.IsEmpty)
                return;

            DockState dockState = tab.Content.DockHandler.DockState;
            IDockContent content = tab.Content;

            GraphicsPath path = GetTabOutline(tab, false, true);
            g.FillPath(BrushTabBackground, path);

            String tabStyle = PluginCore.PluginBase.MainForm.GetThemeValue("VS2005AutoHideStrip.TabStyle");
            Color tabUlColor = PluginCore.PluginBase.MainForm.GetThemeColor("VS2005AutoHideStrip.TabUnderlineColor");

            if (tabStyle == "Underlined")
            {
                Int32 spacing = ScaleHelper.Scale(4);
                Brush brush = tabUlColor != Color.Empty ? new SolidBrush(tabUlColor) : SystemBrushes.Highlight;
                if (dockState == DockState.DockRightAutoHide)
                {
                    g.FillRectangle(brush, new Rectangle(rectTabOrigin.Left + spacing, rectTabOrigin.Y, rectTabOrigin.Width - (spacing * 2), spacing));
                    rectTabOrigin.Y += spacing;
                }
                else if (dockState == DockState.DockTopAutoHide)
                {
                    g.FillRectangle(brush, new Rectangle(rectTabOrigin.X + spacing, rectTabOrigin.Bottom - (spacing / 3), rectTabOrigin.Width - (spacing * 2), rectTabOrigin.Bottom));
                    rectTabOrigin.Y -= (spacing / 3);
                }
                else
                {
                    g.FillRectangle(brush, new Rectangle(rectTabOrigin.X + spacing, rectTabOrigin.Bottom - spacing, rectTabOrigin.Width - (spacing * 2), rectTabOrigin.Bottom));
                    rectTabOrigin.Y -= spacing;
                }
            }
            else g.DrawPath(PenTabBorder, path);

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

            // Draw the icon
            Rectangle rectImage = rectTabOrigin;

            // HACK - This makes the Silk icon set look better (although it is NOT VS 2005 behavior)
            if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide)
                rectImage.Y -= 1;

            rectImage.X += ImageGapLeft;
            rectImage.Y += ImageGapTop;
            int imageHeight = rectTabOrigin.Height - ImageGapTop - ImageGapBottom;
            int imageWidth = ImageWidth;
            if (imageHeight > ImageHeight)
                imageWidth = ImageWidth * (imageHeight/ImageHeight);
            rectImage.Height = imageHeight;
            rectImage.Width = imageWidth;
            rectImage = GetTransformedRectangle(dockState, rectImage);

            if (tabStyle != "Underlined") g.DrawIcon(((Form)content).Icon, RtlTransform(rectImage, dockState));

            // Draw the text
            Rectangle rectText = rectTabOrigin;

            // CHANGED - Mika
            if (Font.SizeInPoints > 8F) rectText.Y += 1;

            if (tabStyle == "Underlined") rectText.X += TextGapRight;
            else
            {
                rectText.X += ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft;
                rectText.Width -= ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft;
            }

            rectText = RtlTransform(GetTransformedRectangle(dockState, rectText), dockState);
            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;
        }
Exemplo n.º 44
0
        private void DrawTab(Graphics g, TabVS2005 tab)
        {
            Rectangle rectTabOrigin = GetTabRectangle(tab);
            if (rectTabOrigin.IsEmpty)
                return;

            DockState dockState = tab.Content.DockHandler.DockState;
            IDockContent content = tab.Content;

            GraphicsPath path = GetTabOutline(tab, false, true);
            using (LinearGradientBrush brush = new LinearGradientBrush(rectTabOrigin,
                    PaletteHelper.InactiveBackColor1, PaletteHelper.InactiveBackColor2, LinearGradientMode.Vertical))
            {
                brush.Blend = PaletteHelper.ActiveBackColorGradientBlend;
                g.FillPath(brush, path);
            }
            //g.FillPath(BrushTabBackground, path);
            g.DrawPath(PenTabBorder, path);

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

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

            // Draw the text
            Rectangle rectText = rectTabOrigin;
            rectText.X += ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft;
            rectText.Width -= ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft;
            rectText = RtlTransform(GetTransformedRectangle(dockState, rectText), dockState);
            if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide)
                g.DrawString(content.DockHandler.TabText, TextFont, BrushTabText, rectText, StringFormatTabVertical);
            else
                g.DrawString(content.DockHandler.TabText, TextFont, BrushTabText, rectText, StringFormatTabHorizontal);

            // Set rotate back
            g.Transform = matrixRotate;
        }
Exemplo n.º 45
0
		private Rectangle GetTabRectangle(TabVS2005 tab)
		{
			return GetTabRectangle(tab, false);
		}
Exemplo n.º 46
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;
            rectIcon.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);
            Rectangle rectBack = DrawHelper.RtlTransform(this, rect);
            rectBack.Width += rect.X;
            rectBack.X = 0;

            rectText = DrawHelper.RtlTransform(this, rectText);
            rectIcon = DrawHelper.RtlTransform(this, rectIcon);
            GraphicsPath path = GetTabOutline(tab, true, false);
            if (DockPane.ActiveContent == tab.Content)
            {
                Color startColor = DockPane.DockPanel.Skin.DockPaneStripSkin.DocumentGradient.ActiveTabGradient.StartColor;
                Color endColor = DockPane.DockPanel.Skin.DockPaneStripSkin.DocumentGradient.ActiveTabGradient.EndColor;
                LinearGradientMode gradientMode = DockPane.DockPanel.Skin.DockPaneStripSkin.DocumentGradient.ActiveTabGradient.LinearGradientMode;
                g.FillPath(new LinearGradientBrush(rectBack, startColor, endColor, gradientMode), path);
                g.DrawPath(PenDocumentTabActiveBorder, path);

                Color textColor = DockPane.DockPanel.Skin.DockPaneStripSkin.DocumentGradient.ActiveTabGradient.TextColor;
                if (DockPane.IsActiveDocumentPane)
                    TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, BoldFont, rectText, textColor, DocumentTextFormat);
                else
                    TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, TextFont, rectText, textColor, DocumentTextFormat);
            }
            else
            {
                Color startColor = DockPane.DockPanel.Skin.DockPaneStripSkin.DocumentGradient.InactiveTabGradient.StartColor;
                Color endColor = DockPane.DockPanel.Skin.DockPaneStripSkin.DocumentGradient.InactiveTabGradient.EndColor;
                LinearGradientMode gradientMode = DockPane.DockPanel.Skin.DockPaneStripSkin.DocumentGradient.InactiveTabGradient.LinearGradientMode;
                g.FillPath(new LinearGradientBrush(rectBack, startColor, endColor, gradientMode), path);
                g.DrawPath(PenDocumentTabInactiveBorder, path);

                Color textColor = DockPane.DockPanel.Skin.DockPaneStripSkin.DocumentGradient.InactiveTabGradient.TextColor;
                TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, TextFont, rectText, textColor, DocumentTextFormat);
            }

            if (rectTab.Contains(rectIcon) && DockPane.DockPanel.ShowDocumentIcon)
                g.DrawIcon(new Icon(tab.Content.DockHandler.Icon, new Size(rectIcon.Width, rectIcon.Height)), rectIcon);
        }
Exemplo n.º 47
0
        private void DrawTab(Graphics g, TabVS2005 tab)
        {
            Rectangle rectTabOrigin = this.GetTabRectangle(tab);
            if (rectTabOrigin.IsEmpty)
                return;

            DockState dockState = tab.Content.DockHandler.DockState;
            IDockContent content = tab.Content;

            GraphicsPath path = this.GetTabOutline(tab, false, true);

            Color startColor = DockPanel.Skin.AutoHideStripSkin.TabGradient.StartColor;
            Color endColor = DockPanel.Skin.AutoHideStripSkin.TabGradient.EndColor;
            LinearGradientMode gradientMode = DockPanel.Skin.AutoHideStripSkin.TabGradient.LinearGradientMode;
            g.FillPath(new LinearGradientBrush(rectTabOrigin, startColor, endColor, gradientMode), path);
            g.DrawPath(PenTabBorder, path);

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

            // Draw the icon
            Rectangle rectImage = rectTabOrigin;
            rectImage.X += ImageGapLeft;
            rectImage.Y += ImageGapTop;
            int imageHeight = rectTabOrigin.Height - ImageGapTop - ImageGapBottom;
            int imageWidth = ImageWidth;
            if (imageHeight > ImageHeight)
                imageWidth = ImageWidth * (imageHeight / ImageHeight);
            rectImage.Height = imageHeight;
            rectImage.Width = imageWidth;
            rectImage = this.GetTransformedRectangle(dockState, rectImage);

            if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide)
            {
                // The DockState is DockLeftAutoHide or DockRightAutoHide, so rotate the _srcTexture 90 degrees to the right.
                Rectangle rectTransform = this.RtlTransform(rectImage, dockState);
                Point[] rotationPoints =
                {
                    new Point(rectTransform.X + rectTransform.Width, rectTransform.Y),
                    new Point(rectTransform.X + rectTransform.Width, rectTransform.Y + rectTransform.Height),
                    new Point(rectTransform.X, rectTransform.Y)
                };

                using (var rotatedIcon = new Icon(((Form)content).Icon, 16, 16))
                {
                    g.DrawImage(rotatedIcon.ToBitmap(), rotationPoints);
                }
            }
            else
            {
                // Draw the icon normally without any rotation.
                g.DrawIcon(((Form)content).Icon, this.RtlTransform(rectImage, dockState));
            }

            // Draw the text
            Rectangle rectText = rectTabOrigin;
            rectText.X += ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft;
            rectText.Width -= ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft;
            rectText = this.RtlTransform(this.GetTransformedRectangle(dockState, rectText), dockState);

            Color textColor = DockPanel.Skin.AutoHideStripSkin.TabGradient.TextColor;

            if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide)
                g.DrawString(content.DockHandler.TabText, this.TextFont, new SolidBrush(textColor), rectText, this.StringFormatTabVertical);
            else
                g.DrawString(content.DockHandler.TabText, this.TextFont, new SolidBrush(textColor), rectText, this.StringFormatTabHorizontal);

            // Set rotate back
            g.Transform = matrixRotate;
        }
 private Rectangle GetTabRectangle(TabVS2005 tab)
 {
     return(GetTabRectangle(tab, false));
 }
Exemplo n.º 49
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();
                /*if (PluginCore.PluginBase.Settings.UseSystemColors)
                {
                    using (Pen pen = new Pen(SystemColors.ControlLight))
                    {
                        g.DrawLine(pen, r.Left + 2, r.Bottom - 1, r.Right - 1, r.Bottom - 1);
                    }
                }
                else
                {*/
                    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);
        }
Exemplo n.º 50
0
		private void DrawTab(Graphics g, TabVS2005 tab)
		{
			Rectangle rectTabOrigin = GetTabRectangle(tab);
			if (rectTabOrigin.IsEmpty)
				return;

			DockState dockState = tab.Content.DockHandler.DockState;
			IDockContent content = tab.Content;

            GraphicsPath path = GetTabOutline(tab, false, true);
            g.FillPath(BrushTabBackground, path);
            g.DrawPath(PenTabBorder, path);

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

			// Draw the icon
			Rectangle rectImage = rectTabOrigin;

            // HACK - This makes the Silk icon set look better (although it is NOT VS 2005 behavior)
            if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide)
                rectImage.Y -= 1;

			rectImage.X += ImageGapLeft;
			rectImage.Y += ImageGapTop;
			int imageHeight = rectTabOrigin.Height - ImageGapTop - ImageGapBottom;
			int imageWidth = ImageWidth;
			if (imageHeight > ImageHeight)
				imageWidth = ImageWidth * (imageHeight/ImageHeight);
			rectImage.Height = imageHeight;
			rectImage.Width = imageWidth;
			rectImage = GetTransformedRectangle(dockState, rectImage);
			g.DrawIcon(((Form)content).Icon, RtlTransform(rectImage, dockState));

			// Draw the text
			Rectangle rectText = rectTabOrigin;

            // CHANGED - Mika
            if (Font.SizeInPoints > 8F) rectText.Y += 1;

			rectText.X += ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft;
			rectText.Width -= ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft;
			rectText = RtlTransform(GetTransformedRectangle(dockState, rectText), dockState);
			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;
		}
Exemplo n.º 51
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);
            }
        }
Exemplo n.º 52
0
		private Rectangle GetTabRectangle(TabVS2005 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 = rectTabStrip.Y + 
				(dockState == DockState.DockTopAutoHide || dockState == DockState.DockRightAutoHide ?
				0 : 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));
		}
Exemplo n.º 53
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 brush = new LinearGradientBrush(ClientRectangle,
                    PaletteHelper.ActiveBackColor1, PaletteHelper.ActiveBackColor2, LinearGradientMode.Vertical))
                {
                    brush.Blend = PaletteHelper.ActiveBackColorGradientBlend;
                    g.FillPath(brush, path);
                }
                //g.FillPath(BrushDocumentActiveBackground, path);
                g.DrawPath(PaletteHelper.PenDocumentTabActiveBorder, path);
                if (DockPane.IsActiveDocumentPane)
                    TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, BoldFont, rectText,
                        PaletteHelper.ColorDocumentActiveText, DocumentTextFormat);
                else
                    TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, TextFont, rectText,
                        PaletteHelper.ColorDocumentActiveText, DocumentTextFormat);
            }
            else
            {
                using (LinearGradientBrush brush = new LinearGradientBrush(ClientRectangle,
                    PaletteHelper.InactiveBackColor1, PaletteHelper.InactiveBackColor2, LinearGradientMode.Vertical))
                {
                    brush.Blend = PaletteHelper.ActiveBackColorGradientBlend;
                    g.FillPath(brush, path);
                }
                //g.FillPath(BrushDocumentInactiveBackground, path);
                g.DrawPath(PaletteHelper.PenDocumentTabInactiveBorder, path);
                TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, TextFont, rectText,
                    PaletteHelper.ColorDocumentInactiveText, DocumentTextFormat);
            }

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