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

            if (rectTab.IsEmpty)
            {
                return;
            }

            DockState    dockState = tab.Content.DockHandler.DockState;
            IDockContent 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.DockHandler.Icon, rectImage);

            // Draw the text
            if (content == content.DockHandler.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.DockHandler.TabText, Font, brushTabText, rectText, StringFormatTabVertical);
                }
                else
                {
                    g.DrawString(content.DockHandler.TabText, Font, brushTabText, rectText, StringFormatTabHorizontal);
                }
            }

            // Set rotate back
            g.Transform = matrixRotate;

            EndDrawTab();
        }
		private Rectangle GetTabRectangle(AutoHideTabFromBase 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 = ((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));
		}
		private Rectangle GetTabRectangle(AutoHideTabFromBase tab)
		{
			return GetTabRectangle(tab, false);
		}
		private void DrawTab(Graphics g, AutoHideTabFromBase tab)
		{
			Rectangle rectTab = GetTabRectangle(tab);
			if (rectTab.IsEmpty)
				return;

			DockState dockState = tab.Content.DockHandler.DockState;
			IDockContent 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.DockHandler.Icon, rectImage);

			// Draw the text
			if (content == content.DockHandler.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.DockHandler.TabText, Font, brushTabText, rectText, StringFormatTabVertical);
				else
					g.DrawString(content.DockHandler.TabText, Font, brushTabText, rectText, StringFormatTabHorizontal);
			}

			// Set rotate back
			g.Transform = matrixRotate;

			EndDrawTab();
		}