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 GraphicsPath GetTabOutline_Document(Tab tab, bool rtlTransform, bool toScreen, bool full) { int curveSize = 6; GraphicsPath.Reset(); Rectangle rect = GetTabRectangle(Tabs.IndexOf(tab)); if (rtlTransform) { rect = DrawHelper.RtlTransform(this, rect); } if (toScreen) { rect = RectangleToScreen(rect); } if (tab.Content == DockPane.ActiveContent || Tabs.IndexOf(tab) == StartDisplayingTab || full) { if (RightToLeft == RightToLeft.Yes) { GraphicsPath.AddLine(rect.Right, rect.Bottom, rect.Right + rect.Height / 2, rect.Bottom); GraphicsPath.AddLine(rect.Right + rect.Height / 2, rect.Bottom, rect.Right - rect.Height / 2 + curveSize / 2, rect.Top + curveSize / 2); } else { GraphicsPath.AddLine(rect.Left, rect.Bottom, rect.Left - rect.Height / 2, rect.Bottom); GraphicsPath.AddLine(rect.Left - rect.Height / 2, rect.Bottom, rect.Left + rect.Height / 2 - curveSize / 2, rect.Top + curveSize / 2); } } else { if (RightToLeft == RightToLeft.Yes) { GraphicsPath.AddLine(rect.Right, rect.Bottom, rect.Right, rect.Bottom - rect.Height / 2); GraphicsPath.AddLine(rect.Right, rect.Bottom - rect.Height / 2, rect.Right - rect.Height / 2 + curveSize / 2, rect.Top + curveSize / 2); } else { GraphicsPath.AddLine(rect.Left, rect.Bottom, rect.Left, rect.Bottom - rect.Height / 2); GraphicsPath.AddLine(rect.Left, rect.Bottom - rect.Height / 2, rect.Left + rect.Height / 2 - curveSize / 2, rect.Top + curveSize / 2); } } if (RightToLeft == RightToLeft.Yes) { GraphicsPath.AddLine(rect.Right - rect.Height / 2 - curveSize / 2, rect.Top, rect.Left + curveSize / 2, rect.Top); GraphicsPath.AddArc(new Rectangle(rect.Left, rect.Top, curveSize, curveSize), 180, 90); } else { GraphicsPath.AddLine(rect.Left + rect.Height / 2 + curveSize / 2, rect.Top, rect.Right - curveSize / 2, rect.Top); GraphicsPath.AddArc(new Rectangle(rect.Right - curveSize, rect.Top, curveSize, curveSize), -90, 90); } if (Tabs.IndexOf(tab) != EndDisplayingTab && (Tabs.IndexOf(tab) != Tabs.Count - 1 && Tabs[Tabs.IndexOf(tab) + 1].Content == DockPane.ActiveContent) && !full) { if (RightToLeft == RightToLeft.Yes) { GraphicsPath.AddLine(rect.Left, rect.Top + curveSize / 2, rect.Left, rect.Top + rect.Height / 2); GraphicsPath.AddLine(rect.Left, rect.Top + rect.Height / 2, rect.Left + rect.Height / 2, rect.Bottom); } else { GraphicsPath.AddLine(rect.Right, rect.Top + curveSize / 2, rect.Right, rect.Top + rect.Height / 2); GraphicsPath.AddLine(rect.Right, rect.Top + rect.Height / 2, rect.Right - rect.Height / 2, rect.Bottom); } } else { if (RightToLeft == RightToLeft.Yes) { GraphicsPath.AddLine(rect.Left, rect.Top + curveSize / 2, rect.Left, rect.Bottom); } else { GraphicsPath.AddLine(rect.Right, rect.Top + curveSize / 2, rect.Right, rect.Bottom); } } return(GraphicsPath); }
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); 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 DrawCaption(Graphics g) { if (ClientRectangle.Width == 0 || ClientRectangle.Height == 0) { return; } Rectangle rect = ClientRectangle; Color captionColor; if (DockPane.IsActivePane) { captionColor = DockPane.DockPanel.Theme.Skin.ColorPalette.ToolWindowCaptionActive.Background; } else { captionColor = DockPane.DockPanel.Theme.Skin.ColorPalette.ToolWindowCaptionInactive.Background; } SolidBrush captionBrush = DockPane.DockPanel.Theme.PaintingService.GetBrush(captionColor); g.FillRectangle(captionBrush, rect); Rectangle rectCaption = rect; Rectangle rectCaptionText = rectCaption; rectCaptionText.X += TextGapLeft; rectCaptionText.Width -= TextGapLeft + TextGapRight; rectCaptionText.Width -= ButtonGapLeft + ButtonClose.Width + ButtonGapRight; if (ShouldShowAutoHideButton) { rectCaptionText.Width -= ButtonAutoHide.Width + ButtonGapBetween; } if (HasTabPageContextMenu) { rectCaptionText.Width -= ButtonOptions.Width + ButtonGapBetween; } rectCaptionText.Y += TextGapTop; rectCaptionText.Height -= TextGapTop + TextGapBottom; Color colorText; if (DockPane.IsActivated) { colorText = DockPane.DockPanel.Theme.Skin.ColorPalette.ToolWindowCaptionActive.Text; } else { colorText = DockPane.DockPanel.Theme.Skin.ColorPalette.ToolWindowCaptionInactive.Text; } TextRenderer.DrawText(g, DockPane.CaptionText, TextFont, DrawHelper.RtlTransform(this, rectCaptionText), colorText, TextFormat); Rectangle rectDotsStrip = rectCaptionText; int textLength = (int)g.MeasureString(DockPane.CaptionText, TextFont).Width + TextGapLeft; rectDotsStrip.X += textLength; rectDotsStrip.Width -= textLength; rectDotsStrip.Height = ClientRectangle.Height; Color dotsColor; if (DockPane.IsActivated) { dotsColor = DockPane.DockPanel.Theme.Skin.ColorPalette.ToolWindowCaptionActive.Grip; } else { dotsColor = DockPane.DockPanel.Theme.Skin.ColorPalette.ToolWindowCaptionInactive.Grip; } DrawDotsStrip(g, rectDotsStrip, dotsColor); }
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 DrawCaption(Graphics g) { if (ClientRectangle.Width == 0 || ClientRectangle.Height == 0) { return; } if (DockPane.IsActivated) { Color startColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.StartColor; Color endColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.EndColor; LinearGradientMode gradientMode = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.LinearGradientMode; using (LinearGradientBrush brush = new LinearGradientBrush(ClientRectangle, startColor, endColor, gradientMode)) { brush.Blend = ActiveBackColorGradientBlend; g.FillRectangle(brush, ClientRectangle); } Color borderTop = startColor.Lerp(Color.White, .7f); Color borderBottom = endColor.Lerp(Color.Black, .8f); using (Pen pen = new Pen(borderTop)) { g.DrawLine(pen, 0, 1, ClientRectangle.Width, 1); } using (Pen pen = new Pen(borderBottom)) { g.DrawLine(pen, 0, 0, ClientRectangle.Width, 0); } using (Pen pen = new Pen(borderBottom)) { g.DrawLine(pen, 0, ClientRectangle.Bottom - 1, ClientRectangle.Width, ClientRectangle.Bottom - 1); } } else { Color startColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.StartColor; Color endColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.EndColor; LinearGradientMode gradientMode = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.LinearGradientMode; using (LinearGradientBrush brush = new LinearGradientBrush(ClientRectangle, startColor, endColor, gradientMode)) { g.FillRectangle(brush, ClientRectangle); } Color borderTop = startColor.Lerp(Color.White, .7f); Color borderBottom = endColor.Lerp(Color.Black, .8f); using (Pen pen = new Pen(borderTop)) { g.DrawLine(pen, 0, 1, ClientRectangle.Width, 1); } using (Pen pen = new Pen(borderBottom)) { g.DrawLine(pen, 0, 0, ClientRectangle.Width, 0); } using (Pen pen = new Pen(borderBottom)) { g.DrawLine(pen, 0, ClientRectangle.Bottom - 1, ClientRectangle.Width, ClientRectangle.Bottom - 1); } } Rectangle rectCaption = ClientRectangle; Rectangle rectCaptionText = rectCaption; rectCaptionText.X += TextGapLeft; rectCaptionText.Width -= TextGapLeft + TextGapRight; rectCaptionText.Width -= ButtonGapLeft + ButtonClose.Width + ButtonGapRight; if (ShouldShowAutoHideButton) { rectCaptionText.Width -= ButtonAutoHide.Width + ButtonGapBetween; } if (HasTabPageContextMenu) { rectCaptionText.Width -= ButtonOptions.Width + ButtonGapBetween; } rectCaptionText.Y += TextGapTop; rectCaptionText.Height -= TextGapTop + TextGapBottom; Color colorText; if (DockPane.IsActivated) { colorText = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.TextColor; } else { colorText = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.TextColor; } TextRenderer.DrawText(g, DockPane.CaptionText, TextFont, DrawHelper.RtlTransform(this, rectCaptionText), colorText, TextFormat); Rectangle rectDotsStrip = rectCaptionText; int textLength = (int)g.MeasureString(DockPane.CaptionText, TextFont).Width + TextGapLeft; rectDotsStrip.X += textLength + 5; rectDotsStrip.Width -= textLength + 8; rectDotsStrip.Height = ClientRectangle.Height; Color dotsColor; if (DockPane.IsActivated) { dotsColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.EndColor.Lerp(Color.Black, .8f); } else { dotsColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.EndColor.Lerp(Color.Black, .3f); } DrawDotsStrip(g, rectDotsStrip, dotsColor); }
private void DrawCaption(Graphics g) { if (ClientRectangle.Width == 0 || ClientRectangle.Height == 0) { return; } Rectangle rect = ClientRectangle; Color captionColor; var theme = (VS2012LightTheme)DockPane.DockPanel.Theme; if (DockPane.IsActivated || theme.ForceActiveCaptionColor) { captionColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.StartColor; } else { captionColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.StartColor; } SolidBrush captionBrush = new SolidBrush(captionColor); g.FillRectangle(captionBrush, rect); Rectangle rectCaption = rect; Rectangle rectCaptionText = rectCaption; rectCaptionText.X += TextGapLeft; rectCaptionText.Width -= TextGapLeft + TextGapRight; //CHANGED: Make the dots extend properly when the close button is not showing. //rectCaptionText.Width -= ButtonGapLeft + ButtonClose.Width + ButtonGapRight; rectCaptionText.Width -= ButtonGapLeft + ButtonGapRight; if (CloseButtonVisible) { rectCaptionText.Width -= ButtonClose.Width; } if (ShouldShowAutoHideButton) { rectCaptionText.Width -= ButtonAutoHide.Width + ButtonGapBetween; } if (HasTabPageContextMenu) { rectCaptionText.Width -= ButtonOptions.Width + ButtonGapBetween; } rectCaptionText.Y += TextGapTop; rectCaptionText.Height -= TextGapTop + TextGapBottom; Color colorText; if (DockPane.IsActivated || theme.ForceActiveCaptionColor) { colorText = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.TextColor; } else { colorText = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.TextColor; } TextRenderer.DrawText(g, DockPane.CaptionText, TextFont, DrawHelper.RtlTransform(this, rectCaptionText), colorText, TextFormat); Rectangle rectDotsStrip = rectCaptionText; int textLength = (int)g.MeasureString(DockPane.CaptionText, TextFont).Width + TextGapLeft; rectDotsStrip.X += textLength; rectDotsStrip.Width -= textLength; rectDotsStrip.Height = ClientRectangle.Height; Color dotsColor; if (DockPane.IsActivated || theme.ForceActiveCaptionColor) { dotsColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.EndColor; } else { dotsColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.EndColor; } DrawDotsStrip(g, rectDotsStrip, dotsColor); }
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 gradientBrush = new LinearGradientBrush(path.GetBounds(), tab.Content.TabColor1, tab.Content.TabColor2, 270f)) { g.FillPath(gradientBrush, 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 { using (LinearGradientBrush gradientBrush = new LinearGradientBrush(path.GetBounds(), ControlPaint.Light(tab.Content.TabColor1), ControlPaint.Light(tab.Content.TabColor2), 270f)) { g.FillPath(gradientBrush, path); } using (Pen pen = new Pen(SystemColors.InactiveBorder, .5f)) { g.DrawPath(pen, 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); } }