ArcGIS Explorer Component Help |
Application..::.ColorScheme Property |
Application Class Example See Also |
Gets or sets the color scheme of the ArcGIS Explorer application.
Namespace:
ESRI.ArcGISExplorer.ApplicationAssembly: ESRI.ArcGISExplorer.Application (in ESRI.ArcGISExplorer.Application.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public static ColorScheme ColorScheme { get; set; } |
Visual Basic (Declaration) |
---|
Public Shared Property ColorScheme As ColorScheme |
Field Value
One of the ColorScheme values each of which represents one of the supported color schemes in the ArcGIS Explorer application.Remarks
Version Information: This property is supported from version 2.0.0.1500.
Examples
The code below demonstrates the ColorScheme property using a ComboBox add-in which
allows users to change the applications color scheme.
CopyC#
using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using ESRI.ArcGISExplorer; using ESRI.ArcGISExplorer.Application; namespace ChangeColorScheme { public class ColorSchemeComboBox : ESRI.ArcGISExplorer.Application.ComboBox { /// <summary> /// Initializes a new instance of the ColorSchemeComboBox class. /// </summary> public ColorSchemeComboBox() { //Add the items to the ComboBox and tag each //item with the actual ColorScheme enum value Items.AddItem("Silver").Tag = ColorScheme.Silver; Items.AddItem("Black").Tag = ColorScheme.Black; Items.AddItem("Aqua").Tag = ColorScheme.Aqua; Items.AddItem("Blue").Tag = ColorScheme.Blue; //Get the currently runnning color scheme ColorScheme currentColorScheme = Application.ColorScheme; //Set the currently selected combo box item to the applications current color scheme this.SelectedItem = FindComboItemByColorScheme(currentColorScheme); } /// <summary> /// The applcation color scheme is changed to match to users choice. /// </summary> /// <param name="item"></param> public override void OnSelectionChange(ComboItem item) { //Set the ColorScheme property to the chosen scheme if (item != null) Application.ColorScheme = (ColorScheme)item.Tag; } /// <summary> /// Helper method to find the combo item which matches a particular color scheme /// </summary> private ComboItem FindComboItemByColorScheme(ColorScheme clrScheme) { ComboItem foundItem = null; foreach (ComboItem item in this.Items) { if ((ColorScheme)item.Tag == clrScheme) { foundItem = item; break; } } return foundItem; } } }
CopyVB.NET
Imports System.Collections.Generic Imports System.ComponentModel Imports System.Drawing Imports ESRI.ArcGISExplorer Imports ESRI.ArcGISExplorer.Application Public Class ColorSchemeComboBox Inherits ESRI.ArcGISExplorer.Application.ComboBox ''' <summary> ''' Initializes a new instance of the ColorSchemeComboBox class. ''' </summary> Public Sub New() 'Add the items to the ComboBox and tag each 'item with the actual ColorScheme enum value Items.AddItem("Silver").Tag = ColorScheme.Silver Items.AddItem("Black").Tag = ColorScheme.Black Items.AddItem("Aqua").Tag = ColorScheme.Aqua Items.AddItem("Blue").Tag = ColorScheme.Blue 'Get the currently runnning color scheme Dim currentColorScheme As ColorScheme = Application.ColorScheme 'Set the currently selected combo box item to the applications current color scheme Me.SelectedItem = FindComboItemByColorScheme(currentColorScheme) End Sub ''' <summary> ''' The applcation color scheme is changed to match to users choice. ''' </summary> ''' <param name="item"></param> Public Overrides Sub OnSelectionChange(ByVal item As ComboItem) 'Set the ColorScheme property to the chosen scheme If item IsNot Nothing Then Application.ColorScheme = DirectCast(item.Tag, ColorScheme) End If End Sub ''' <summary> ''' Helper method to find the combo item which matches a particular color scheme ''' </summary> Private Function FindComboItemByColorScheme(ByVal clrScheme As ColorScheme) As ComboItem Dim foundItem As ComboItem = Nothing For Each item As ComboItem In Me.Items If DirectCast(item.Tag, ColorScheme) = clrScheme Then foundItem = item Exit For End If Next Return foundItem End Function End Class