Esempio n. 1
0
        private Rectangle GetTabRectangle(AutoHideTabFromBase tab, bool transformed)
        {
            DockState dockState    = tab.Content.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  = ((AutoHideTabFromBase)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)));
            }
        }
Esempio n. 2
0
 private Rectangle GetTabRectangle(AutoHideTabFromBase tab)
 {
     return(GetTabRectangle(tab, false));
 }
Esempio n. 3
0
        private void DrawTab(Graphics g, AutoHideTabFromBase tab)
        {
            Rectangle rectTab = GetTabRectangle(tab);

            if (rectTab.IsEmpty)
            {
                return;
            }

            DockState   dockState = tab.Content.DockState;
            DockContent content   = tab.Content;

            BeginDrawTab();


            Pen   penTabBorder = PenTabBorder;
            Brush brushTabText = new SolidBrush(ColorMixer.AutoHideTabTextColor);

            if (dockState == DockState.DockTopAutoHide || dockState == DockState.DockRightAutoHide)
            {
                DrawUtil.DrawVSTab(g, rectTab, Color.WhiteSmoke, Color.DimGray, false);
            }
            else
            {
                DrawUtil.DrawVSTab(g, rectTab, Color.WhiteSmoke, Color.DimGray, false);
            }

//			g.FillRectangle(new LinearGradientBrush(rectTab,ColorMixer.DarkColor,ColorMixer.LightColor,LinearGradientMode.Vertical)
//				, rectTab);
//
//			g.DrawLine(penTabBorder, rectTab.Left, rectTab.Top, rectTab.Left, rectTab.Bottom);
//			g.DrawLine(penTabBorder, rectTab.Right, rectTab.Top, rectTab.Right, rectTab.Bottom);
//			if (dockState == DockState.DockTopAutoHide || dockState == DockState.DockRightAutoHide)
//				g.DrawLine(penTabBorder, rectTab.Left, rectTab.Bottom, rectTab.Right, rectTab.Bottom);
//			else
//				g.DrawLine(penTabBorder, rectTab.Left, rectTab.Top, rectTab.Right, rectTab.Top);


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

            g.Transform = MatrixIdentity;

            // Draw the icon
            Rectangle rectImage = rectTab;

            rectImage.X += ImageGapLeft;
            rectImage.Y += ImageGapTop;
            int imageHeight = rectTab.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(content.Icon, rectImage);

            // Draw the text
            if (content == content.Pane.ActiveContent)
            {
                Rectangle rectText = rectTab;
                rectText.X     += ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft;
                rectText.Width -= ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft;
                rectText        = GetTransformedRectangle(dockState, rectText);
                if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide)
                {
                    g.DrawString(content.TabText, Font, brushTabText, rectText, StringFormatTabVertical);
                }
                else
                {
                    g.DrawString(content.TabText, Font, brushTabText, rectText, StringFormatTabHorizontal);
                }
            }

            // Set rotate back
            g.Transform = matrixRotate;

            EndDrawTab();
        }