private void drawNodeText(object sender, DrawTreeNodeEventArgs e) { Font nodeTextFont = e.Node.NodeFont; if (nodeTextFont == null) { nodeTextFont = ((TreeView)sender).Font; } Color nodeTextColor; if (e.Node == e.Node.TreeView.SelectedNode) { Color selectedItemActiveTextColor = VsColors.GetThemedGDIColor(_shell5, TreeViewColors.SelectedItemActiveTextColorKey); nodeTextColor = selectedItemActiveTextColor; } else { Color backTextColor = VsColors.GetThemedGDIColor(_shell5, TreeViewColors.BackgroundTextColorKey); nodeTextColor = backTextColor; } Rectangle nodeTextRectangle = e.Node.Bounds; nodeTextRectangle.Width += 40; TextRenderer.DrawText(e.Graphics, e.Node.Text, nodeTextFont, Rectangle.Inflate(nodeTextRectangle, -15, 0), nodeTextColor, TextFormatFlags.GlyphOverhangPadding); }
private void drawBackground(DrawTreeNodeEventArgs e) { Color backgroundColor = VsColors.GetThemedGDIColor(_shell5, TreeViewColors.BackgroundColorKey); if (e.Node.TreeView.BackColor != backgroundColor) { e.Node.TreeView.BackColor = backgroundColor; } }
private void drawNodeSelection(object sender, DrawTreeNodeEventArgs e) { if (e.Node == e.Node.TreeView.SelectedNode) { if (((TreeView)sender).Focused) { Color selectedItemActiveColor = VsColors.GetThemedGDIColor(_shell5, TreeViewColors.SelectedItemActiveColorKey); Color focusVisualBorderColorKey = VsColors.GetThemedGDIColor(_shell5, TreeViewColors.FocusVisualBorderColorKey); e.Graphics.FillRectangle(new SolidBrush(selectedItemActiveColor), e.Bounds); ControlPaint.DrawBorder(e.Graphics, e.Bounds, focusVisualBorderColorKey, ButtonBorderStyle.Solid); } else { Color selectedItemInactiveColor = VsColors.GetThemedGDIColor(_shell5, TreeViewColors.SelectedItemInactiveColorKey); e.Graphics.FillRectangle(new SolidBrush(selectedItemInactiveColor), e.Bounds); } } }
public void SetPropertyGridColors(IVsUIShell5 shell) { var backgroundColor = VsColors.GetThemedGDIColor(shell, EnvironmentColors.ToolWindowBackgroundColorKey); var foregroundColor = VsColors.GetThemedGDIColor(shell, EnvironmentColors.ToolWindowTextColorKey); var lineColor = VsColors.GetThemedGDIColor(shell, EnvironmentColors.ToolWindowContentGridColorKey); var disabledColor = VsColors.GetThemedGDIColor(shell, EnvironmentColors.SystemGrayTextColorKey); var highlightColor = VsColors.GetThemedGDIColor(shell, EnvironmentColors.SystemHighlightColorKey); var highlightTextColor = VsColors.GetThemedGDIColor(shell, EnvironmentColors.SystemHighlightTextColorKey); var hyperLinkColor = VsColors.GetThemedGDIColor(shell, EnvironmentColors.ControlLinkTextColorKey); var hyperLinkActiveColor = VsColors.GetThemedGDIColor(shell, EnvironmentColors.ControlLinkTextPressedColorKey); if (!SystemInformation.HighContrast || !DotNetFrameworkUtilities.IsInstalledFramework471OrAbove()) { _propertyGrid.LineColor = lineColor; } _propertyGrid.ViewBackColor = backgroundColor; _propertyGrid.ViewForeColor = foregroundColor; _propertyGrid.ViewBorderColor = lineColor; _propertyGrid.HelpBackColor = backgroundColor; _propertyGrid.HelpForeColor = foregroundColor; _propertyGrid.HelpBorderColor = backgroundColor; _propertyGrid.CategoryForeColor = foregroundColor; _propertyGrid.CategorySplitterColor = lineColor; _propertyGrid.CommandsActiveLinkColor = hyperLinkActiveColor; _propertyGrid.CommandsDisabledLinkColor = disabledColor; _propertyGrid.CommandsLinkColor = hyperLinkColor; _propertyGrid.CommandsForeColor = foregroundColor; _propertyGrid.CommandsBackColor = backgroundColor; _propertyGrid.CommandsDisabledLinkColor = disabledColor; _propertyGrid.CommandsBorderColor = backgroundColor; _propertyGrid.SelectedItemWithFocusForeColor = highlightTextColor; _propertyGrid.SelectedItemWithFocusBackColor = highlightColor; _propertyGrid.DisabledItemForeColor = disabledColor; _propertyGrid.CanShowVisualStyleGlyphs = false; }
public void SetPropertyGridColors() { ThreadHelper.ThrowIfNotOnUIThread(); IVsUIShell5 shell = (IVsUIShell5)GetVsService(typeof(SVsUIShell)); var backgroundColorDarker = VsColors.GetThemedGDIColor(shell, EnvironmentColors.ToolWindowBackgroundColorKey); var backgroundColorLighter = VsColors.GetThemedGDIColor(shell, EnvironmentColors.BrandedUIBackgroundColorKey); var searchBoxBackgroundColorKey = VsColors.GetThemedGDIColor(shell, EnvironmentColors.SearchBoxBackgroundColorKey); var foregroundColor = VsColors.GetThemedGDIColor(shell, EnvironmentColors.ToolWindowTextColorKey); var buttonFaceColor = VsColors.GetThemedGDIColor(shell, EnvironmentColors.SystemButtonFaceBrushKey); var buttonTextColor = VsColors.GetThemedGDIColor(shell, EnvironmentColors.SystemButtonTextColorKey); this.searchButton.BackColor = buttonFaceColor; this.searchButton.ForeColor = buttonTextColor; this.searchOptionBar.BackColor = backgroundColorLighter; this.searchOptionBar.ForeColor = foregroundColor; this.searchBox.BackColor = searchBoxBackgroundColorKey; this.searchBox.ForeColor = foregroundColor; this.showCountComboBox.BackColor = searchBoxBackgroundColorKey; this.showCountComboBox.ForeColor = foregroundColor; this.showCountLabel.BackColor = backgroundColorLighter; this.showCountLabel.ForeColor = foregroundColor; this.languageLabel.BackColor = backgroundColorLighter; this.languageLabel.ForeColor = foregroundColor; this.languageFilters.BackColor = backgroundColorLighter; this.languageFilters.ForeColor = foregroundColor; this.panel1.BackColor = backgroundColorLighter; this.panel1.ForeColor = foregroundColor; this.panel2.BackColor = backgroundColorLighter; this.panel2.ForeColor = foregroundColor; this.tableLayoutPanel1.BackColor = backgroundColorLighter; //this.tableLayoutPanel1.ForeColor = foregroundColor; this.tableLayoutPanel1.CellBorderStyle = TableLayoutPanelCellBorderStyle.None; this.toolStripSeparator1.BackColor = backgroundColorLighter; this.toolStripSeparator1.ForeColor = foregroundColor; this.snippetExplorerSplitter.BackColor = backgroundColorLighter; this.previewCodeWindow.ForeColor = foregroundColor; this.previewCodeWindow.BackColor = backgroundColorDarker; }