예제 #1
0
        GraphicsPath GetTabOutline(VS2010Tab tab, bool transformed, bool rtlTransform)
        {
            DockState dockState = tab.Content.DockHandler.DockState;
            Rectangle rectTab   = GetTabRectangle(tab, transformed);

            if (rtlTransform)
            {
                rectTab = RtlTransform(rectTab, dockState);
            }

            var path = new GraphicsPath();

            path.AddRectangle(rectTab);

            return(path);
        }
예제 #2
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            var tab = (VS2010Tab)TabHitTest(PointToClient(MousePosition));

            if (tab != null)
            {
                tab.IsMouseOver = true;
                Invalidate();
            }

            if (lastSelectedTab != tab)
            {
                if (lastSelectedTab != null)
                {
                    lastSelectedTab.IsMouseOver = false;
                }
                lastSelectedTab = tab;
            }

            base.OnMouseMove(e);
        }
예제 #3
0
        Rectangle GetTabRectangle(VS2010Tab 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));
            }
            return(GetTransformedRectangle(dockState, new Rectangle(x, y, width, height)));
        }
예제 #4
0
		void DrawTab_Document(Graphics g, VS2010Tab tab, Rectangle rect) {
			if (tab.TabWidth == 0)
				return;

			var rectCloseButton = GetCloseButtonRect(rect);
			if (!tab.Content.DockHandler.CloseButtonVisible)
				rectCloseButton = Rectangle.Empty;

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

			Rectangle rectText = new Rectangle(
				rect.X + DocumentIconGapLeft,
				rect.Y,
				rect.Width - DocumentIconGapLeft, rect.Height - 1);

			if (DockPane.DockPanel.ShowDocumentIcon) {
				rectText.X += DocumentIconWidth + DocumentIconGapRight;
				rectText.Width -= DocumentIconWidth + DocumentIconGapRight;
			}

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

			if (DockPane.ActiveContent == tab.Content) {
				using (var brush = new LinearGradientBrush(rect, Color.Empty, Color.Empty, LinearGradientMode.Vertical))
				using (var roundedRect = RoundedRectangle.Construct(rect, 6, RoundedCorner.TopLeft | RoundedCorner.TopRight)) {
					if (DockPane.IsActiveDocumentPane) {
						brush.InterpolationColors = DockPane.IsActivated ? ActiveBackColorGradientBlend : UnfocusedBackColorGradientBlend;
						g.FillPath(brush, roundedRect);
						TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, TextFont, rectText, Color.Black, DocumentTextFormat);
					}
					else {
						brush.InterpolationColors = InactiveBackColorGradientBlend;
						g.FillPath(brush, roundedRect);
						TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, TextFont, rectText, Color.White, DocumentTextFormat);
					}
					DrawCloseButton(g, ForeColor, rectCloseButton);
				}
			}
			else {
				if (tab.Content == DockPane.MouseOverTab) {
					using (var brush = new LinearGradientBrush(rect, Color.Empty, Color.Empty, LinearGradientMode.Vertical))
					using (var pen = new Pen(new SolidBrush(VS2010Theme.ARGB(0xFF9BA7B7))))
					using (var roundedRect = RoundedRectangle.Construct(rect, 6, RoundedCorner.TopLeft | RoundedCorner.TopRight)) {
						brush.InterpolationColors = HoverColorBlend;
						g.FillPath(brush, roundedRect);
						g.DrawPath(pen, roundedRect);
					}
					DrawCloseButton(g, GlyphColor, rectCloseButton);
				}
				TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, TextFont, rectText, Color.White, DocumentTextFormat);
			}

			if (rectTab.Contains(rectIcon) && DockPane.DockPanel.ShowDocumentIcon) {
				using (var icon = new Icon(tab.Content.DockHandler.Icon, rectIcon.Size))
					g.DrawIcon(icon, rectIcon);
			}
		}
예제 #5
0
		void DrawTab_ToolWindow(Graphics g, VS2010Tab tab, Rectangle rect) {
			rect.Width--;
			rect.Y--;

			Rectangle rectIcon = new Rectangle(
				rect.X + ToolWindowImageGapLeft,
				rect.Y + rect.Height - ToolWindowImageGapBottom - ToolWindowImageHeight,
				ToolWindowImageWidth, ToolWindowImageHeight);

			Rectangle rectText = new Rectangle(
				rect.X + ToolWindowImageGapLeft,
				rect.Y,
				rect.Width - ToolWindowImageGapLeft, rect.Height - 1);

			rectText.X += ToolWindowImageWidth + ToolWindowImageGapRight;
			rectText.Width -= ToolWindowImageWidth + ToolWindowImageGapRight;

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

			if (DockPane.ActiveContent == tab.Content) {
				using (var roundedRect = RoundedRectangle.Construct(rect, 4, RoundedCorner.BottomLeft | RoundedCorner.BottomRight)) {
					g.FillPath(Brushes.White, roundedRect);
					g.DrawPath(Pens.White, roundedRect);
					TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, TextFont, rectText, Color.Black, DocumentTextFormat);
				}
			}
			else {
				if (tab.Content == DockPane.MouseOverTab) {
					using (var brush = new LinearGradientBrush(rect, Color.Empty, Color.Empty, LinearGradientMode.Vertical))
					using (var pen = new Pen(new SolidBrush(VS2010Theme.ARGB(0xFF9BA7B7)), 1))
					using (var roundedRect = RoundedRectangle.Construct(rect, 4, RoundedCorner.BottomLeft | RoundedCorner.BottomRight)) {
						brush.InterpolationColors = HoverColorBlend;
						g.FillPath(brush, roundedRect);
						g.DrawPath(pen, roundedRect);
					}
				}
				TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, TextFont, rectText, Color.White, DocumentTextFormat);
			}

			if (rectTab.Contains(rectIcon)) {
				using (var icon = new Icon(tab.Content.DockHandler.Icon, rectIcon.Size))
					g.DrawIcon(icon, rectIcon);
			}
		}
예제 #6
0
		void DrawTab(Graphics g, VS2010Tab tab, Rectangle rect) {
			if (Appearance == DockPane.AppearanceStyle.ToolWindow)
				DrawTab_ToolWindow(g, tab, rect);
			else
				DrawTab_Document(g, tab, rect);
		}
예제 #7
0
		Rectangle GetTabRectangle_Document(VS2010Tab tab) {
			Rectangle rectTabStrip = TabStripRectangle;

			Rectangle rect = new Rectangle();
			rect.X = tab.TabX;
			rect.Width = tab.TabWidth;
			rect.Height = rectTabStrip.Height - DocumentTabGapTop;

			if (DockPane.DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Bottom)
				rect.Y = rectTabStrip.Y + DocumentStripGapBottom;
			else
				rect.Y = rectTabStrip.Y + DocumentTabGapTop;

			return rect;
		}
예제 #8
0
		Rectangle GetTabRectangle_ToolWindow(VS2010Tab tab) {
			Rectangle rectTabStrip = TabStripRectangle;

			return new Rectangle(tab.TabX, rectTabStrip.Y, tab.TabWidth, rectTabStrip.Height);
		}
예제 #9
0
		Rectangle GetTabRectangle(VS2010Tab tab) {
			if (Appearance == DockPane.AppearanceStyle.ToolWindow)
				return GetTabRectangle_ToolWindow(tab);
			return GetTabRectangle_Document(tab);
		}
예제 #10
0
 Rectangle GetTabRectangle(VS2010Tab tab)
 {
     return(GetTabRectangle(tab, false));
 }
예제 #11
0
        void DrawTab(Graphics g, VS2010Tab tab)
        {
            Rectangle rectTabOrigin = GetTabRectangle(tab);

            if (rectTabOrigin.IsEmpty)
            {
                return;
            }

            rectTabOrigin.X++;
            rectTabOrigin.Width -= 2;

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

            var corner = RoundedCorner.TopLeft | RoundedCorner.TopRight;

            if (dockState == DockState.DockRightAutoHide || dockState == DockState.DockTopAutoHide)
            {
                corner = RoundedCorner.BottomLeft | RoundedCorner.BottomRight;
            }

            using (var brush = new LinearGradientBrush(rectTabOrigin, Color.Empty, Color.Empty, LinearGradientMode.Vertical))
                using (var roundedRect = RoundedRectangle.Construct(rectTabOrigin, 6, corner)) {
                    if (tab.IsMouseOver)
                    {
                        brush.InterpolationColors = HoverColorBlend;
                        g.FillPath(brush, roundedRect);
                        using (var pen = new Pen(new SolidBrush(VS2010Theme.ARGB(0xFF9BA7B7))))
                            g.DrawPath(pen, roundedRect);
                    }
                    else
                    {
                        brush.InterpolationColors = InactiveColorBlend;
                        g.FillPath(brush, roundedRect);
                    }
                }

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

            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.

                using (var icon = new Icon(((Form)content).Icon, rectImage.Size))
                    g.DrawIcon(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;
        }
예제 #12
0
		protected override void OnMouseMove(MouseEventArgs e) {
			var tab = (VS2010Tab)TabHitTest(PointToClient(MousePosition));
			if (tab != null) {
				tab.IsMouseOver = true;
				Invalidate();
			}

			if (lastSelectedTab != tab) {
				if (lastSelectedTab != null)
					lastSelectedTab.IsMouseOver = false;
				lastSelectedTab = tab;
			}

			base.OnMouseMove(e);
		}
예제 #13
0
		Rectangle GetTabRectangle(VS2010Tab 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);
			return GetTransformedRectangle(dockState, new Rectangle(x, y, width, height));
		}
예제 #14
0
		Rectangle GetTabRectangle(VS2010Tab tab) {
			return GetTabRectangle(tab, false);
		}
예제 #15
0
		void DrawTab(Graphics g, VS2010Tab tab) {
			Rectangle rectTabOrigin = GetTabRectangle(tab);
			if (rectTabOrigin.IsEmpty)
				return;

			rectTabOrigin.X++;
			rectTabOrigin.Width -= 2;

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

			var corner = RoundedCorner.TopLeft | RoundedCorner.TopRight;
			if (dockState == DockState.DockRightAutoHide || dockState == DockState.DockTopAutoHide)
				corner = RoundedCorner.BottomLeft | RoundedCorner.BottomRight;

			using (var brush = new LinearGradientBrush(rectTabOrigin, Color.Empty, Color.Empty, LinearGradientMode.Vertical))
			using (var roundedRect = RoundedRectangle.Construct(rectTabOrigin, 6, corner)) {
				if (tab.IsMouseOver) {
					brush.InterpolationColors = HoverColorBlend;
					g.FillPath(brush, roundedRect);
					using (var pen = new Pen(new SolidBrush(VS2010Theme.ARGB(0xFF9BA7B7))))
						g.DrawPath(pen, roundedRect);
				}
				else {
					brush.InterpolationColors = InactiveColorBlend;
					g.FillPath(brush, roundedRect);
				}
			}

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

			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.

				using (var icon = new Icon(((Form)content).Icon, rectImage.Size))
					g.DrawIcon(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;
		}
예제 #16
0
		GraphicsPath GetTabOutline(VS2010Tab tab, bool transformed, bool rtlTransform) {
			DockState dockState = tab.Content.DockHandler.DockState;
			Rectangle rectTab = GetTabRectangle(tab, transformed);
			if (rtlTransform)
				rectTab = RtlTransform(rectTab, dockState);

			var path = new GraphicsPath();
			path.AddRectangle(rectTab);

			return path;
		}