コード例 #1
0
        private Rectangle GetTabRectangle(VS2005AutoHideStrip.TabVS2005 tab, bool transformed)
        {
            DockState dockState = tab.Content.DockHandler.DockState;
            Rectangle logicalTabStripRectangle = this.GetLogicalTabStripRectangle(dockState);

            checked
            {
                Rectangle result;
                if (logicalTabStripRectangle.IsEmpty)
                {
                    result = Rectangle.Empty;
                }
                else
                {
                    int tabX     = tab.TabX;
                    int y        = logicalTabStripRectangle.Y + ((dockState == DockState.DockTopAutoHide || dockState == DockState.DockRightAutoHide) ? 0 : VS2005AutoHideStrip.TabGapTop);
                    int tabWidth = tab.TabWidth;
                    int height   = logicalTabStripRectangle.Height - VS2005AutoHideStrip.TabGapTop;
                    if (!transformed)
                    {
                        result = new Rectangle(tabX, y, tabWidth, height);
                    }
                    else
                    {
                        result = this.GetTransformedRectangle(dockState, new Rectangle(tabX, y, tabWidth, height));
                    }
                }
                return(result);
            }
        }
コード例 #2
0
        protected override IDockContent HitTest(Point ptMouse)
        {
            DockState[]  dockStates = VS2005AutoHideStrip.DockStates;
            IDockContent result;

            for (int i = 0; i < dockStates.Length; i++)
            {
                DockState dockState = dockStates[i];
                if (this.GetLogicalTabStripRectangle(dockState, true).Contains(ptMouse))
                {
                    foreach (AutoHideStripBase.Pane current in (IEnumerable <AutoHideStripBase.Pane>)base.GetPanes(dockState))
                    {
                        using (IEnumerator <AutoHideStripBase.Tab> enumerator2 = ((IEnumerable <AutoHideStripBase.Tab>)current.AutoHideTabs).GetEnumerator())
                        {
                            while (enumerator2.MoveNext())
                            {
                                VS2005AutoHideStrip.TabVS2005 tabVS = (VS2005AutoHideStrip.TabVS2005)enumerator2.Current;
                                GraphicsPath tabOutline             = this.GetTabOutline(tabVS, true, true);
                                if (tabOutline.IsVisible(ptMouse))
                                {
                                    result = tabVS.Content;
                                    return(result);
                                }
                            }
                        }
                    }
                }
            }
            result = null;
            return(result);
        }
コード例 #3
0
        private void CalculateTabs(DockState dockState)
        {
            Rectangle logicalTabStripRectangle = this.GetLogicalTabStripRectangle(dockState);

            checked
            {
                int num  = logicalTabStripRectangle.Height - VS2005AutoHideStrip.ImageGapTop - VS2005AutoHideStrip.ImageGapBottom;
                int num2 = VS2005AutoHideStrip.ImageWidth;
                if (num > VS2005AutoHideStrip.ImageHeight)
                {
                    num2 = VS2005AutoHideStrip.ImageWidth * (num / VS2005AutoHideStrip.ImageHeight);
                }
                int num3 = VS2005AutoHideStrip.TabGapLeft + logicalTabStripRectangle.X;
                foreach (AutoHideStripBase.Pane current in (IEnumerable <AutoHideStripBase.Pane>)base.GetPanes(dockState))
                {
                    using (IEnumerator <AutoHideStripBase.Tab> enumerator2 = ((IEnumerable <AutoHideStripBase.Tab>)current.AutoHideTabs).GetEnumerator())
                    {
                        while (enumerator2.MoveNext())
                        {
                            VS2005AutoHideStrip.TabVS2005 tabVS = (VS2005AutoHideStrip.TabVS2005)enumerator2.Current;
                            int num4 = num2 + VS2005AutoHideStrip.ImageGapLeft + VS2005AutoHideStrip.ImageGapRight + TextRenderer.MeasureText(tabVS.Content.DockHandler.TabText, this.TextFont).Width + VS2005AutoHideStrip.TextGapLeft + VS2005AutoHideStrip.TextGapRight;
                            tabVS.TabX     = num3;
                            tabVS.TabWidth = num4;
                            num3          += num4;
                        }
                    }
                    num3 += VS2005AutoHideStrip.TabGapBetween;
                }
            }
        }
コード例 #4
0
        private void DrawTabStrip(Graphics g, DockState dockState)
        {
            Rectangle logicalTabStripRectangle = this.GetLogicalTabStripRectangle(dockState);

            if (!logicalTabStripRectangle.IsEmpty)
            {
                Matrix transform = g.Transform;
                if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide)
                {
                    Matrix matrix = new Matrix();
                    matrix.RotateAt(90f, new PointF((float)logicalTabStripRectangle.X + (float)logicalTabStripRectangle.Height / 2f, (float)logicalTabStripRectangle.Y + (float)logicalTabStripRectangle.Height / 2f));
                    g.Transform = matrix;
                }
                foreach (AutoHideStripBase.Pane current in (IEnumerable <AutoHideStripBase.Pane>)base.GetPanes(dockState))
                {
                    using (IEnumerator <AutoHideStripBase.Tab> enumerator2 = ((IEnumerable <AutoHideStripBase.Tab>)current.AutoHideTabs).GetEnumerator())
                    {
                        while (enumerator2.MoveNext())
                        {
                            VS2005AutoHideStrip.TabVS2005 tab = (VS2005AutoHideStrip.TabVS2005)enumerator2.Current;
                            this.DrawTab(g, tab);
                        }
                    }
                }
                g.Transform = transform;
            }
        }
コード例 #5
0
        private GraphicsPath GetTabOutline(VS2005AutoHideStrip.TabVS2005 tab, bool transformed, bool rtlTransform)
        {
            DockState dockState = tab.Content.DockHandler.DockState;
            Rectangle rect      = this.GetTabRectangle(tab, transformed);

            if (rtlTransform)
            {
                rect = this.RtlTransform(rect, dockState);
            }
            bool upCorner = dockState == DockState.DockLeftAutoHide || dockState == DockState.DockBottomAutoHide;

            DrawHelper.GetRoundedCornerTab(VS2005AutoHideStrip.GraphicsPath, rect, upCorner);
            return(VS2005AutoHideStrip.GraphicsPath);
        }
コード例 #6
0
 private Rectangle GetTabRectangle(VS2005AutoHideStrip.TabVS2005 tab)
 {
     return(this.GetTabRectangle(tab, false));
 }
コード例 #7
0
        private void DrawTab(Graphics g, VS2005AutoHideStrip.TabVS2005 tab)
        {
            Rectangle tabRectangle = this.GetTabRectangle(tab);

            checked
            {
                if (!tabRectangle.IsEmpty)
                {
                    DockState          dockState          = tab.Content.DockHandler.DockState;
                    IDockContent       content            = tab.Content;
                    GraphicsPath       tabOutline         = this.GetTabOutline(tab, false, 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(VS2005AutoHideStrip.PenTabBorder, tabOutline);
                    Matrix transform = g.Transform;
                    g.Transform = VS2005AutoHideStrip.MatrixIdentity;
                    Rectangle rect = tabRectangle;
                    rect.X += VS2005AutoHideStrip.ImageGapLeft;
                    rect.Y += VS2005AutoHideStrip.ImageGapTop;
                    int num  = tabRectangle.Height - VS2005AutoHideStrip.ImageGapTop - VS2005AutoHideStrip.ImageGapBottom;
                    int num2 = VS2005AutoHideStrip.ImageWidth;
                    if (num > VS2005AutoHideStrip.ImageHeight)
                    {
                        num2 = VS2005AutoHideStrip.ImageWidth * (num / VS2005AutoHideStrip.ImageHeight);
                    }
                    rect.Height = num;
                    rect.Width  = num2;
                    rect        = this.GetTransformedRectangle(dockState, rect);
                    if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide)
                    {
                        Rectangle rectangle  = this.RtlTransform(rect, dockState);
                        Point[]   destPoints = new Point[]
                        {
                            new Point(rectangle.X + rectangle.Width, rectangle.Y),
                            new Point(rectangle.X + rectangle.Width, rectangle.Y + rectangle.Height),
                            new Point(rectangle.X, rectangle.Y)
                        };
                        using (Icon icon = new Icon(((Form)content).Icon, 16, 16))
                        {
                            g.DrawImage(icon.ToBitmap(), destPoints);
                        }
                    }
                    else
                    {
                        g.DrawIcon(((Form)content).Icon, this.RtlTransform(rect, dockState));
                    }
                    Rectangle rectangle2 = tabRectangle;
                    rectangle2.X     += VS2005AutoHideStrip.ImageGapLeft + num2 + VS2005AutoHideStrip.ImageGapRight + VS2005AutoHideStrip.TextGapLeft;
                    rectangle2.Width -= VS2005AutoHideStrip.ImageGapLeft + num2 + VS2005AutoHideStrip.ImageGapRight + VS2005AutoHideStrip.TextGapLeft;
                    rectangle2        = this.RtlTransform(this.GetTransformedRectangle(dockState, rectangle2), dockState);
                    Color textColor = base.DockPanel.Skin.AutoHideStripSkin.TabGradient.TextColor;
                    if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide)
                    {
                        g.DrawString(content.DockHandler.TabText, this.TextFont, new SolidBrush(textColor), rectangle2, this.StringFormatTabVertical);
                    }
                    else
                    {
                        g.DrawString(content.DockHandler.TabText, this.TextFont, new SolidBrush(textColor), rectangle2, this.StringFormatTabHorizontal);
                    }
                    g.Transform = transform;
                }
            }
        }