TreeViewColors
Namespace:
Microsoft.VisualStudio.Shell.15.0
We found 10 examples in language CSharp for this search.
You will see 35 fragments of code.
Other methods
Other methods
Project:monodevelop
File:ColorShemeEditor.cs
Examples:6
void SyntaxCellRenderer (Gtk.CellLayout cell_layout, Gtk.CellRenderer cell, Gtk.TreeModel tree_model, Gtk.TreeIter iter)
{
var renderer = (Gtk.CellRendererText)cell;
var data = (ColorScheme.PropertyDecsription)colorStore.GetValue (iter, 1);
string markup = GLib.Markup.EscapeText (data.Attribute.Name);
renderer.Markup = markup;
}
void ApplyStyle (ColorScheme sheme)
{
sheme.Name = entryName.Text;
sheme.Description = entryDescription.Text;
Gtk.TreeIter iter;
if (colorStore.GetIterFirst (out iter)) {
do {
var data = (ColorScheme.PropertyDecsription)colorStore.GetValue (iter, 1);
var style = colorStore.GetValue (iter, 2);
data.Info.SetValue (sheme, style, null);
} while (colorStore.IterNext (ref iter));
}
}
public static void RefreshAllColors ()
{
foreach (var doc in Ide.IdeApp.Workbench.Documents) {
var editor = doc.Editor;
if (editor == null)
continue;
doc.UpdateParseDocument ();
editor.Parent.TextViewMargin.PurgeLayoutCache ();
editor.Document.CommitUpdateAll ();
}
}
void HandleButtonOkClicked (object sender, EventArgs e)
{
ApplyStyle (colorSheme);
try {
if (fileName.EndsWith (".vssettings", StringComparison.Ordinal)) {
System.IO.File.Delete (fileName);
fileName += "Style.json";
}
colorSheme.Save (fileName);
panel.ShowStyles ();
} catch (Exception ex) {
MessageService.ShowException (ex);
}
RefreshAllColors ();
}
void Stylechanged (object sender, EventArgs e)
{
Gtk.TreeIter iter;
if (!this.treeviewColors.Selection.GetSelected (out iter))
return;
var o = colorStore.GetValue (iter, 2);
if (o is ChunkStyle) {
SetChunkStyle (iter, (ChunkStyle)o);
} else if (o is AmbientColor) {
SetAmbientColor (iter, (AmbientColor)o);
}
}
Cairo.Color GetColorFromButton (ColorButton button)
{
return new Cairo.Color (button.Color.Red / (double)ushort.MaxValue, button.Color.Green / (double)ushort.MaxValue, button.Color.Blue / (double)ushort.MaxValue, button.Alpha / (double)ushort.MaxValue);
}
Project:monodevelop
File:ColorShemeEditor.cs
Examples:6
void SyntaxCellRenderer (Gtk.CellLayout cell_layout, Gtk.CellRenderer cell, Gtk.TreeModel tree_model, Gtk.TreeIter iter)
{
var renderer = (Gtk.CellRendererText)cell;
var data = (ColorScheme.PropertyDecsription)colorStore.GetValue (iter, 1);
string markup = GLib.Markup.EscapeText (data.Attribute.Name);
renderer.Markup = markup;
}
void ApplyStyle (ColorScheme sheme)
{
sheme.Name = entryName.Text;
sheme.Description = entryDescription.Text;
Gtk.TreeIter iter;
if (colorStore.GetIterFirst (out iter)) {
do {
var data = (ColorScheme.PropertyDecsription)colorStore.GetValue (iter, 1);
var style = colorStore.GetValue (iter, 2);
data.Info.SetValue (sheme, style, null);
} while (colorStore.IterNext (ref iter));
}
}
public static void RefreshAllColors ()
{
foreach (var doc in Ide.IdeApp.Workbench.Documents) {
var editor = doc.Editor;
if (editor == null)
continue;
doc.UpdateParseDocument ();
editor.Parent.TextViewMargin.PurgeLayoutCache ();
editor.Document.CommitUpdateAll ();
}
}
void HandleButtonOkClicked (object sender, EventArgs e)
{
ApplyStyle (colorSheme);
try {
if (fileName.EndsWith (".vssettings", StringComparison.Ordinal)) {
System.IO.File.Delete (fileName);
fileName += "Style.json";
}
colorSheme.Save (fileName);
panel.ShowStyles ();
} catch (Exception ex) {
LoggingService.LogInternalError (ex);
}
RefreshAllColors ();
}
void Stylechanged (object sender, EventArgs e)
{
Gtk.TreeIter iter;
if (!this.treeviewColors.Selection.GetSelected (out iter))
return;
var o = colorStore.GetValue (iter, 2);
if (o is ChunkStyle) {
SetChunkStyle (iter, (ChunkStyle)o);
} else if (o is AmbientColor) {
SetAmbientColor (iter, (AmbientColor)o);
}
}
Cairo.Color GetColorFromButton (ColorButton button)
{
return new Cairo.Color (button.Color.Red / (double)ushort.MaxValue, button.Color.Green / (double)ushort.MaxValue, button.Color.Blue / (double)ushort.MaxValue, button.Alpha / (double)ushort.MaxValue);
}
Project:Git-Source-Control-Provider
File:TreeViewColors.cs
Examples:1
private static object GetResourceKey(string resourceName, object defaultKey)
{
return PlatformColorHelper.GetResourceKey(typeof(TreeViewColors), resourceName) ?? defaultKey;
}
Project:Dev-Source
File:TreeViewColors.cs
Examples:1
private static object GetResourceKey(string resourceName, object defaultKey)
{
return PlatformColorHelper.GetResourceKey(typeof(TreeViewColors), resourceName) ?? defaultKey;
}
Project:git-tools
File:TreeViewColors.cs
Examples:1
private static object GetResourceKey(string resourceName, object defaultKey)
{
return PlatformColorHelper.GetResourceKey(typeof(TreeViewColors), resourceName) ?? defaultKey;
}
Project:Git-Source-Control-Provider
File:TreeViewColors.cs
Examples:1
private static object GetResourceKey(string resourceName, object defaultKey)
{
return PlatformColorHelper.GetResourceKey(typeof(TreeViewColors), resourceName) ?? defaultKey;
}
Project:gitscc
File:TreeViewColors.cs
Examples:1
private static object GetResourceKey(string resourceName, object defaultKey)
{
return PlatformColorHelper.GetResourceKey(typeof(TreeViewColors), resourceName) ?? defaultKey;
}
Project:monodevelop
File:ColorShemeEditor.cs
Examples:6
void SyntaxCellRenderer (Gtk.CellLayout cell_layout, Gtk.CellRenderer cell, Gtk.TreeModel tree_model, Gtk.TreeIter iter)
{
var renderer = (Gtk.CellRendererText)cell;
var data = (ColorScheme.PropertyDecsription)colorStore.GetValue (iter, 1);
string markup = GLib.Markup.EscapeText (data.Attribute.Name);
renderer.Markup = markup;
}
void ApplyStyle (ColorScheme sheme)
{
sheme.Name = entryName.Text;
sheme.Description = entryDescription.Text;
Gtk.TreeIter iter;
if (colorStore.GetIterFirst (out iter)) {
do {
var data = (ColorScheme.PropertyDecsription)colorStore.GetValue (iter, 1);
var style = colorStore.GetValue (iter, 2);
data.Info.SetValue (sheme, style, null);
} while (colorStore.IterNext (ref iter));
}
}
public static void RefreshAllColors ()
{
foreach (var doc in Ide.IdeApp.Workbench.Documents) {
var editor = doc.Editor;
if (editor == null)
continue;
doc.UpdateParseDocument ();
editor.Parent.TextViewMargin.PurgeLayoutCache ();
editor.Document.CommitUpdateAll ();
}
}
void HandleButtonOkClicked (object sender, EventArgs e)
{
ApplyStyle (colorSheme);
try {
if (fileName.EndsWith (".vssettings", StringComparison.Ordinal)) {
System.IO.File.Delete (fileName);
fileName += "Style.json";
}
colorSheme.Save (fileName);
panel.ShowStyles ();
} catch (Exception ex) {
LoggingService.LogInternalError (ex);
}
RefreshAllColors ();
}
void Stylechanged (object sender, EventArgs e)
{
Gtk.TreeIter iter;
if (!this.treeviewColors.Selection.GetSelected (out iter))
return;
var o = colorStore.GetValue (iter, 2);
if (o is ChunkStyle) {
SetChunkStyle (iter, (ChunkStyle)o);
} else if (o is AmbientColor) {
SetAmbientColor (iter, (AmbientColor)o);
}
}
Cairo.Color GetColorFromButton (ColorButton button)
{
return new Cairo.Color (button.Color.Red / (double)ushort.MaxValue, button.Color.Green / (double)ushort.MaxValue, button.Color.Blue / (double)ushort.MaxValue, button.Alpha / (double)ushort.MaxValue);
}
Project:SHFB
File:ThemeColors.cs
Examples:6
/// <summary>
/// This raises the <see cref="PropertyChanged"/> event
/// </summary>
/// <param name="propertyName">The property name that changed</param>
private void OnPropertyChanged(string propertyName)
{
var handler = PropertyChanged;
if(handler != null)
handler(this, new PropertyChangedEventArgs(propertyName));
}
#if !STANDALONEGUI
/// <summary>
/// This event handler is called when the Visual Studio theme changes and raise the property change
/// notification so that the colors are updated in any controls that use them.
/// </summary>
/// <param name="e">The event arguments</param>
private void VSColorTheme_ThemeChanged(ThemeChangedEventArgs e)
{
this.OnPropertyChanged(null);
}
#endif
#endregion
#region Helper Methods
//=====================================================================
/// <summary>
/// This is used to get a Visual Studio theme color for the given theme color ID
/// </summary>
/// <param name="id">The theme color ID for which to get the Visual Studio theme color</param>
/// <returns>The theme color to use</returns>
/// <remarks>Theme colors do not appear to be available at design time. As such, this will return
/// related default system colors in their place.</remarks>
private static Color GetColor(ThemeColorId id)
{
#if !STANDALONEGUI
Color? vsColor = GetVisualStudioColor(id);
if(vsColor != null)
return vsColor.Value;
#endif
// Get colors for design time or if something failed or wasn't defined
return GetDefaultColor(id);
}
#if !STANDALONEGUI
/// <summary>
/// This is used to return a Visual Studio theme color for the given theme color ID
/// </summary>
/// <param name="id">The theme color ID for which to get the Visual Studio theme color</param>
/// <returns>The theme color to use or null if it could not be obtained was not recognized</returns>
private static Color? GetVisualStudioColor(ThemeColorId id)
{
switch(id)
{
case ThemeColorId.ButtonBackgroundColor:
return GetThemeColor(TeamFoundationColors.ButtonColorKey);
case ThemeColorId.ButtonBorderColor:
return GetThemeColor(TeamFoundationColors.ButtonBorderColorKey);
case ThemeColorId.ButtonDisabledBackgroundColor:
return GetThemeColor(TeamFoundationColors.ButtonDisabledColorKey);
case ThemeColorId.ButtonDisabledBorderColor:
return GetThemeColor(TeamFoundationColors.ButtonDisabledBorderColorKey);
case ThemeColorId.ButtonDisabledForegroundColor:
return GetThemeColor(TeamFoundationColors.ButtonDisabledTextColorKey);
case ThemeColorId.ButtonForegroundColor:
return GetThemeColor(TeamFoundationColors.ButtonTextColorKey);
case ThemeColorId.ButtonHoverBackgroundColor:
return GetThemeColor(TeamFoundationColors.ButtonMouseOverColorKey);
case ThemeColorId.ButtonHoverBorderColor:
return GetThemeColor(TeamFoundationColors.ButtonMouseOverBorderColorKey);
case ThemeColorId.ButtonHoverForegroundColor:
return GetThemeColor(TeamFoundationColors.ButtonMouseOverTextColorKey);
case ThemeColorId.ButtonPressedBackgroundColor:
return GetThemeColor(TeamFoundationColors.ButtonPressedColorKey);
case ThemeColorId.ButtonPressedBorderColor:
return GetThemeColor(TeamFoundationColors.ButtonPressedBorderColorKey);
case ThemeColorId.ButtonPressedForegroundColor:
return GetThemeColor(TeamFoundationColors.ButtonPressedTextColorKey);
case ThemeColorId.ComboBoxButtonMouseOverBackgroundColor:
return GetThemeColor(EnvironmentColors.ComboBoxButtonMouseOverBackgroundColorKey);
case ThemeColorId.ComboBoxDisabledGlyphColor:
return GetThemeColor(EnvironmentColors.ComboBoxDisabledGlyphColorKey);
case ThemeColorId.ComboBoxGlyphColor:
return GetThemeColor(EnvironmentColors.ComboBoxGlyphColorKey);
case ThemeColorId.ComboBoxPopupBackground:
return GetThemeColor(EnvironmentColors.ComboBoxPopupBackgroundBeginColorKey);
case ThemeColorId.DisabledTextColor:
case ThemeColorId.LightBorderColor:
return GetThemeColor(EnvironmentColors.SystemGrayTextColorKey);
case ThemeColorId.ItemBorderColor:
case ThemeColorId.ItemColor:
return GetThemeColor(TreeViewColors.BackgroundColorKey);
case ThemeColorId.ItemHoverColor:
case ThemeColorId.ItemHoverBorderColor:
return GetThemeColor(EnvironmentColors.CommandBarMouseOverBackgroundMiddle1ColorKey);
case ThemeColorId.ItemHoverTextColor:
case ThemeColorId.MenuHoverTextColor:
return GetThemeColor(EnvironmentColors.CommandBarTextHoverColorKey);
case ThemeColorId.ItemSelectedBorderColor:
case ThemeColorId.ItemSelectedColor:
return GetThemeColor(TreeViewColors.SelectedItemActiveColorKey);
case ThemeColorId.ItemSelectedBorderNotFocusedColor:
case ThemeColorId.ItemSelectedNotFocusedColor:
return GetThemeColor(TreeViewColors.SelectedItemInactiveColorKey);
case ThemeColorId.ItemSelectedTextColor:
return GetThemeColor(TreeViewColors.SelectedItemActiveTextColorKey);
case ThemeColorId.ItemSelectedTextNotFocusedColor:
return GetThemeColor(TreeViewColors.SelectedItemInactiveTextColorKey);
case ThemeColorId.ItemTextColor:
return GetThemeColor(TreeViewColors.BackgroundTextColorKey);
case ThemeColorId.LinkTextColor:
return GetThemeColor(EnvironmentColors.ControlLinkTextColorKey);
case ThemeColorId.LinkTextHoverColor:
return GetThemeColor(EnvironmentColors.ControlLinkTextHoverColorKey);
case ThemeColorId.MenuBackgroundColor:
return GetThemeColor(EnvironmentColors.CommandBarMenuBackgroundGradientBeginColorKey);
case ThemeColorId.MenuBorderColor:
return GetThemeColor(EnvironmentColors.CommandBarMenuBorderColorKey);
case ThemeColorId.MenuHoverBackgroundColor:
return GetThemeColor(EnvironmentColors.CommandBarMouseOverBackgroundBeginColorKey);
case ThemeColorId.MenuSeparatorColor:
return GetThemeColor(EnvironmentColors.CommandBarMenuSeparatorColorKey);
case ThemeColorId.MenuTextColor:
return GetThemeColor(EnvironmentColors.CommandBarTextActiveColorKey);
case ThemeColorId.NotificationColor:
return GetThemeColor(EnvironmentColors.SystemInfoBackgroundColorKey);
case ThemeColorId.NotificationTextColor:
return GetThemeColor(EnvironmentColors.SystemInfoTextColorKey);
case ThemeColorId.TextBoxBorderColor:
return GetThemeColor(EnvironmentColors.ComboBoxBorderColorKey);
case ThemeColorId.TextBoxColor:
return GetThemeColor(EnvironmentColors.ComboBoxBackgroundColorKey);
case ThemeColorId.TextBoxTextColor:
return GetThemeColor(EnvironmentColors.ComboBoxItemTextColorKey);
case ThemeColorId.ToolWindowBackgroundColor:
return GetThemeColor(EnvironmentColors.ToolWindowBackgroundColorKey);
case ThemeColorId.ToolWindowBorderColor:
return GetThemeColor(EnvironmentColors.ToolWindowBorderColorKey);
case ThemeColorId.ToolWindowTextColor:
return GetThemeColor(EnvironmentColors.ToolWindowTextColorKey);
case ThemeColorId.TreeViewGlyphColor:
return GetThemeColor(TreeViewColors.GlyphColorKey);
case ThemeColorId.TreeViewHoverGlyphColor:
return GetThemeColor(TreeViewColors.GlyphMouseOverColorKey);
default:
return null;
}
}
#endif
/// <summary>
/// This is used to return a default system color for the given theme color ID
/// </summary>
/// <param name="id">The theme color ID for which to get the default system color</param>
/// <returns>The default system color to use</returns>
private static Color GetDefaultColor(ThemeColorId id)
{
switch(id)
{
case ThemeColorId.ButtonBackgroundColor:
return SystemColors.ControlLightColor;
case ThemeColorId.ButtonBorderColor:
case ThemeColorId.ButtonDisabledBorderColor:
case ThemeColorId.ComboBoxButtonMouseOverBackgroundColor:
case ThemeColorId.LightBorderColor:
case ThemeColorId.MenuBorderColor:
case ThemeColorId.MenuSeparatorColor:
case ThemeColorId.ToolWindowBorderColor:
case ThemeColorId.TreeViewHoverGlyphColor:
return SystemColors.ControlDarkColor;
case ThemeColorId.ButtonDisabledBackgroundColor:
case ThemeColorId.ButtonHoverBackgroundColor:
case ThemeColorId.ButtonPressedBackgroundColor:
case ThemeColorId.MenuBackgroundColor:
case ThemeColorId.ToolWindowBackgroundColor:
return SystemColors.ControlColor;
case ThemeColorId.ButtonDisabledForegroundColor:
case ThemeColorId.ButtonForegroundColor:
case ThemeColorId.ButtonHoverForegroundColor:
case ThemeColorId.ButtonPressedForegroundColor:
case ThemeColorId.ComboBoxGlyphColor:
case ThemeColorId.MenuTextColor:
case ThemeColorId.TreeViewGlyphColor:
return SystemColors.ControlTextColor;
case ThemeColorId.ButtonHoverBorderColor:
case ThemeColorId.ButtonPressedBorderColor:
case ThemeColorId.LinkTextColor:
case ThemeColorId.LinkTextHoverColor:
return SystemColors.HotTrackColor;
case ThemeColorId.ComboBoxDisabledGlyphColor:
case ThemeColorId.DisabledTextColor:
return SystemColors.GrayTextColor;
case ThemeColorId.ComboBoxPopupBackground:
case ThemeColorId.ItemBorderColor:
case ThemeColorId.ItemColor:
case ThemeColorId.NotificationColor:
case ThemeColorId.TextBoxColor:
return SystemColors.WindowColor;
case ThemeColorId.ItemHoverColor:
case ThemeColorId.ItemHoverBorderColor:
case ThemeColorId.ItemSelectedNotFocusedColor:
return SystemColors.ControlLightColor;
case ThemeColorId.ItemHoverTextColor:
case ThemeColorId.ItemSelectedTextNotFocusedColor:
case ThemeColorId.ItemTextColor:
case ThemeColorId.NotificationTextColor:
case ThemeColorId.TextBoxTextColor:
case ThemeColorId.ToolWindowTextColor:
return SystemColors.WindowTextColor;
case ThemeColorId.ItemSelectedBorderColor:
case ThemeColorId.ItemSelectedBorderNotFocusedColor:
case ThemeColorId.ItemSelectedColor:
case ThemeColorId.MenuHoverBackgroundColor:
return SystemColors.HighlightColor;
case ThemeColorId.ItemSelectedTextColor:
case ThemeColorId.MenuHoverTextColor:
return SystemColors.HighlightTextColor;
case ThemeColorId.TextBoxBorderColor:
return SystemColors.WindowFrameColor;
default:
return SystemColors.ControlTextColor;
}
}
#if !STANDALONEGUI
/// <summary>
/// This is used to get the theme color for the given them resource key
/// </summary>
/// <param name="themeResourceKey">The theme resource key for which to get the color</param>
/// <returns>The color for the theme resource key or null if it could not be obtained</returns>
private static Color? GetThemeColor(ThemeResourceKey themeResourceKey)
{
try
{
System.Drawing.Color vsThemeColor = VSColorTheme.GetThemedColor(themeResourceKey);
return Color.FromArgb(vsThemeColor.A, vsThemeColor.R, vsThemeColor.G, vsThemeColor.B);
}
catch(Exception ex)
{
System.Diagnostics.Debug.WriteLine("Failed to get Visual Studio theme color {0}. Exception:\r\n{1}",
themeResourceKey.Name, ex);
}
return null;
}
Project:JiraEX
File:ThemeColors.cs
Examples:6
/// <summary>
/// This raises the <see cref="PropertyChanged"/> event
/// </summary>
/// <param name="propertyName">The property name that changed</param>
private void OnPropertyChanged(string propertyName)
{
var handler = PropertyChanged;
if (handler != null)
handler(this, new PropertyChangedEventArgs(propertyName));
}
/// <summary>
/// This event handler is called when the Visual Studio theme changes and raise the property change
/// notification so that the colors are updated in any controls that use them.
/// </summary>
/// <param name="e">The event arguments</param>
private void VSColorTheme_ThemeChanged(ThemeChangedEventArgs e)
{
this.OnPropertyChanged(null);
}
#endregion
#region Helper Methods
//=====================================================================
/// <summary>
/// This is used to get a Visual Studio theme color for the given theme color ID
/// </summary>
/// <param name="id">The theme color ID for which to get the Visual Studio theme color</param>
/// <returns>The theme color to use</returns>
/// <remarks>Theme colors do not appear to be available at design time. As such, this will return
/// related default system colors in their place.</remarks>
private static Color GetColor(ThemeColorId id)
{
Color? vsColor = GetVisualStudioColor(id);
if (vsColor != null)
return vsColor.Value;
// Get colors for design time or if something failed or wasn't defined
return GetDefaultColor(id);
}
/// <summary>
/// This is used to return a Visual Studio theme color for the given theme color ID
/// </summary>
/// <param name="id">The theme color ID for which to get the Visual Studio theme color</param>
/// <returns>The theme color to use or null if it could not be obtained was not recognized</returns>
private static Color? GetVisualStudioColor(ThemeColorId id)
{
switch (id)
{
case ThemeColorId.ButtonBackgroundColor:
return GetThemeColor(TeamFoundationColors.ButtonColorKey);
case ThemeColorId.ButtonBorderColor:
return GetThemeColor(TeamFoundationColors.ButtonBorderColorKey);
case ThemeColorId.ButtonDisabledBackgroundColor:
return GetThemeColor(TeamFoundationColors.ButtonDisabledColorKey);
case ThemeColorId.ButtonDisabledBorderColor:
return GetThemeColor(TeamFoundationColors.ButtonDisabledBorderColorKey);
case ThemeColorId.ButtonDisabledForegroundColor:
return GetThemeColor(TeamFoundationColors.ButtonDisabledTextColorKey);
case ThemeColorId.ButtonForegroundColor:
return GetThemeColor(TeamFoundationColors.ButtonTextColorKey);
case ThemeColorId.ButtonHoverBackgroundColor:
return GetThemeColor(TeamFoundationColors.ButtonMouseOverColorKey);
case ThemeColorId.ButtonHoverBorderColor:
return GetThemeColor(TeamFoundationColors.ButtonMouseOverBorderColorKey);
case ThemeColorId.ButtonHoverForegroundColor:
return GetThemeColor(TeamFoundationColors.ButtonMouseOverTextColorKey);
case ThemeColorId.ButtonPressedBackgroundColor:
return GetThemeColor(TeamFoundationColors.ButtonPressedColorKey);
case ThemeColorId.ButtonPressedBorderColor:
return GetThemeColor(TeamFoundationColors.ButtonPressedBorderColorKey);
case ThemeColorId.ButtonPressedForegroundColor:
return GetThemeColor(TeamFoundationColors.ButtonPressedTextColorKey);
case ThemeColorId.ComboBoxButtonMouseOverBackgroundColor:
return GetThemeColor(EnvironmentColors.ComboBoxButtonMouseOverBackgroundColorKey);
case ThemeColorId.ComboBoxDisabledGlyphColor:
return GetThemeColor(EnvironmentColors.ComboBoxDisabledGlyphColorKey);
case ThemeColorId.ComboBoxGlyphColor:
return GetThemeColor(EnvironmentColors.ComboBoxGlyphColorKey);
case ThemeColorId.ComboBoxPopupBackground:
return GetThemeColor(EnvironmentColors.ComboBoxPopupBackgroundBeginColorKey);
case ThemeColorId.DisabledTextColor:
case ThemeColorId.LightBorderColor:
return GetThemeColor(EnvironmentColors.SystemGrayTextColorKey);
case ThemeColorId.ItemBorderColor:
case ThemeColorId.ItemColor:
return GetThemeColor(TreeViewColors.BackgroundColorKey);
case ThemeColorId.ItemHoverColor:
case ThemeColorId.ItemHoverBorderColor:
return GetThemeColor(EnvironmentColors.CommandBarMouseOverBackgroundMiddle1ColorKey);
case ThemeColorId.ItemHoverTextColor:
case ThemeColorId.MenuHoverTextColor:
return GetThemeColor(EnvironmentColors.CommandBarTextHoverColorKey);
case ThemeColorId.ItemSelectedBorderColor:
case ThemeColorId.ItemSelectedColor:
return GetThemeColor(TreeViewColors.SelectedItemActiveColorKey);
case ThemeColorId.ItemSelectedBorderNotFocusedColor:
case ThemeColorId.ItemSelectedNotFocusedColor:
return GetThemeColor(TreeViewColors.SelectedItemInactiveColorKey);
case ThemeColorId.ItemSelectedTextColor:
return GetThemeColor(TreeViewColors.SelectedItemActiveTextColorKey);
case ThemeColorId.ItemSelectedTextNotFocusedColor:
return GetThemeColor(TreeViewColors.SelectedItemInactiveTextColorKey);
case ThemeColorId.ItemTextColor:
return GetThemeColor(TreeViewColors.BackgroundTextColorKey);
case ThemeColorId.LinkTextColor:
return GetThemeColor(EnvironmentColors.ControlLinkTextColorKey);
case ThemeColorId.LinkTextHoverColor:
return GetThemeColor(EnvironmentColors.ControlLinkTextHoverColorKey);
case ThemeColorId.MenuBackgroundColor:
return GetThemeColor(EnvironmentColors.CommandBarMenuBackgroundGradientBeginColorKey);
case ThemeColorId.MenuBorderColor:
return GetThemeColor(EnvironmentColors.CommandBarMenuBorderColorKey);
case ThemeColorId.MenuHoverBackgroundColor:
return GetThemeColor(EnvironmentColors.CommandBarMouseOverBackgroundBeginColorKey);
case ThemeColorId.MenuSeparatorColor:
return GetThemeColor(EnvironmentColors.CommandBarMenuSeparatorColorKey);
case ThemeColorId.MenuTextColor:
return GetThemeColor(EnvironmentColors.CommandBarTextActiveColorKey);
case ThemeColorId.NotificationColor:
return GetThemeColor(EnvironmentColors.SystemInfoBackgroundColorKey);
case ThemeColorId.NotificationTextColor:
return GetThemeColor(EnvironmentColors.SystemInfoTextColorKey);
case ThemeColorId.TextBoxBorderColor:
return GetThemeColor(EnvironmentColors.ComboBoxBorderColorKey);
case ThemeColorId.TextBoxColor:
return GetThemeColor(EnvironmentColors.ComboBoxBackgroundColorKey);
case ThemeColorId.TextBoxTextColor:
return GetThemeColor(EnvironmentColors.ComboBoxItemTextColorKey);
case ThemeColorId.ToolWindowBackgroundColor:
return GetThemeColor(EnvironmentColors.ToolWindowBackgroundColorKey);
case ThemeColorId.ToolWindowBorderColor:
return GetThemeColor(EnvironmentColors.ToolWindowBorderColorKey);
case ThemeColorId.ToolWindowTextColor:
return GetThemeColor(EnvironmentColors.ToolWindowTextColorKey);
case ThemeColorId.TreeViewGlyphColor:
return GetThemeColor(TreeViewColors.GlyphColorKey);
case ThemeColorId.TreeViewHoverGlyphColor:
return GetThemeColor(TreeViewColors.GlyphMouseOverColorKey);
default:
return null;
}
}
/// <summary>
/// This is used to return a default system color for the given theme color ID
/// </summary>
/// <param name="id">The theme color ID for which to get the default system color</param>
/// <returns>The default system color to use</returns>
private static Color GetDefaultColor(ThemeColorId id)
{
switch (id)
{
case ThemeColorId.ButtonBackgroundColor:
return SystemColors.ControlLightColor;
case ThemeColorId.ButtonBorderColor:
case ThemeColorId.ButtonDisabledBorderColor:
case ThemeColorId.ComboBoxButtonMouseOverBackgroundColor:
case ThemeColorId.LightBorderColor:
case ThemeColorId.MenuBorderColor:
case ThemeColorId.MenuSeparatorColor:
case ThemeColorId.ToolWindowBorderColor:
case ThemeColorId.TreeViewHoverGlyphColor:
return SystemColors.ControlDarkColor;
case ThemeColorId.ButtonDisabledBackgroundColor:
case ThemeColorId.ButtonHoverBackgroundColor:
case ThemeColorId.ButtonPressedBackgroundColor:
case ThemeColorId.MenuBackgroundColor:
case ThemeColorId.ToolWindowBackgroundColor:
return SystemColors.ControlColor;
case ThemeColorId.ButtonDisabledForegroundColor:
case ThemeColorId.ButtonForegroundColor:
case ThemeColorId.ButtonHoverForegroundColor:
case ThemeColorId.ButtonPressedForegroundColor:
case ThemeColorId.ComboBoxGlyphColor:
case ThemeColorId.MenuTextColor:
case ThemeColorId.TreeViewGlyphColor:
return SystemColors.ControlTextColor;
case ThemeColorId.ButtonHoverBorderColor:
case ThemeColorId.ButtonPressedBorderColor:
case ThemeColorId.LinkTextColor:
case ThemeColorId.LinkTextHoverColor:
return SystemColors.HotTrackColor;
case ThemeColorId.ComboBoxDisabledGlyphColor:
case ThemeColorId.DisabledTextColor:
return SystemColors.GrayTextColor;
case ThemeColorId.ComboBoxPopupBackground:
case ThemeColorId.ItemBorderColor:
case ThemeColorId.ItemColor:
case ThemeColorId.NotificationColor:
case ThemeColorId.TextBoxColor:
return SystemColors.WindowColor;
case ThemeColorId.ItemHoverColor:
case ThemeColorId.ItemHoverBorderColor:
case ThemeColorId.ItemSelectedNotFocusedColor:
return SystemColors.ControlLightColor;
case ThemeColorId.ItemHoverTextColor:
case ThemeColorId.ItemSelectedTextNotFocusedColor:
case ThemeColorId.ItemTextColor:
case ThemeColorId.NotificationTextColor:
case ThemeColorId.TextBoxTextColor:
case ThemeColorId.ToolWindowTextColor:
return SystemColors.WindowTextColor;
case ThemeColorId.ItemSelectedBorderColor:
case ThemeColorId.ItemSelectedBorderNotFocusedColor:
case ThemeColorId.ItemSelectedColor:
case ThemeColorId.MenuHoverBackgroundColor:
return SystemColors.HighlightColor;
case ThemeColorId.ItemSelectedTextColor:
case ThemeColorId.MenuHoverTextColor:
return SystemColors.HighlightTextColor;
case ThemeColorId.TextBoxBorderColor:
return SystemColors.WindowFrameColor;
default:
return SystemColors.ControlTextColor;
}
}
/// <summary>
/// This is used to get the theme color for the given them resource key
/// </summary>
/// <param name="themeResourceKey">The theme resource key for which to get the color</param>
/// <returns>The color for the theme resource key or null if it could not be obtained</returns>
private static Color? GetThemeColor(ThemeResourceKey themeResourceKey)
{
try
{
System.Drawing.Color vsThemeColor = VSColorTheme.GetThemedColor(themeResourceKey);
return Color.FromArgb(vsThemeColor.A, vsThemeColor.R, vsThemeColor.G, vsThemeColor.B);
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("Failed to get Visual Studio theme color {0}. Exception:\r\n{1}",
themeResourceKey.Name, ex);
}
return null;
}
Microsoft.VisualStudio.PlatformUI.TreeViewColors : Object
Fields :
public static Guid CategoryMethods :
public static ThemeResourceKey get_BackgroundColorKey()public static ThemeResourceKey get_BackgroundBrushKey()
public static ThemeResourceKey get_BackgroundTextColorKey()
public static ThemeResourceKey get_BackgroundTextBrushKey()
public static ThemeResourceKey get_DragDropInsertionArrowColorKey()
public static ThemeResourceKey get_DragDropInsertionArrowBrushKey()
public static ThemeResourceKey get_DragDropInsertionArrowBorderColorKey()
public static ThemeResourceKey get_DragDropInsertionArrowBorderBrushKey()
public static ThemeResourceKey get_DragOverItemColorKey()
public static ThemeResourceKey get_DragOverItemBrushKey()
public static ThemeResourceKey get_DragOverItemTextColorKey()
public static ThemeResourceKey get_DragOverItemTextBrushKey()
public static ThemeResourceKey get_DragOverItemGlyphColorKey()
public static ThemeResourceKey get_DragOverItemGlyphBrushKey()
public static ThemeResourceKey get_DragOverItemGlyphMouseOverColorKey()
public static ThemeResourceKey get_DragOverItemGlyphMouseOverBrushKey()
public static ThemeResourceKey get_FocusVisualBorderColorKey()
public static ThemeResourceKey get_FocusVisualBorderBrushKey()
public static ThemeResourceKey get_GlyphColorKey()
public static ThemeResourceKey get_GlyphBrushKey()
public static ThemeResourceKey get_GlyphMouseOverColorKey()
public static ThemeResourceKey get_GlyphMouseOverBrushKey()
public static ThemeResourceKey get_HighlightedSpanColorKey()
public static ThemeResourceKey get_HighlightedSpanBrushKey()
public static ThemeResourceKey get_HighlightedSpanTextColorKey()
public static ThemeResourceKey get_HighlightedSpanTextBrushKey()
public static ThemeResourceKey get_SelectedItemActiveColorKey()
public static ThemeResourceKey get_SelectedItemActiveBrushKey()
public static ThemeResourceKey get_SelectedItemActiveTextColorKey()
public static ThemeResourceKey get_SelectedItemActiveTextBrushKey()
public static ThemeResourceKey get_SelectedItemActiveGlyphColorKey()
public static ThemeResourceKey get_SelectedItemActiveGlyphBrushKey()
public static ThemeResourceKey get_SelectedItemActiveGlyphMouseOverColorKey()
public static ThemeResourceKey get_SelectedItemActiveGlyphMouseOverBrushKey()
public static ThemeResourceKey get_SelectedItemInactiveColorKey()
public static ThemeResourceKey get_SelectedItemInactiveBrushKey()
public static ThemeResourceKey get_SelectedItemInactiveTextColorKey()
public static ThemeResourceKey get_SelectedItemInactiveTextBrushKey()
public static ThemeResourceKey get_SelectedItemInactiveGlyphColorKey()
public static ThemeResourceKey get_SelectedItemInactiveGlyphBrushKey()
public static ThemeResourceKey get_SelectedItemInactiveGlyphMouseOverColorKey()
public static ThemeResourceKey get_SelectedItemInactiveGlyphMouseOverBrushKey()
public static ThemeResourceKey get_ValidationSquigglesColorKey()
public static ThemeResourceKey get_ValidationSquigglesBrushKey()
public Type GetType()
public String ToString()
public Boolean Equals(Object obj = )
public Int32 GetHashCode()