ArcObjects Library Reference  

ColorCommand

About the Creating a toolbar of globe tools Sample

[C#]

ColorCommand.cs

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using ESRI.ArcGIS.ADF.BaseClasses;
using ESRI.ArcGIS.ADF.CATIDs;
using System.Windows.Forms;


namespace GlobeGraphicsToolbar
{
    public class ColorCommand : ESRI.ArcGIS.Desktop.AddIns.Button
    {
        private ColorPalette _colorPalette = null;

        public ColorCommand()
        {
            _colorPalette = new ColorPalette();

            ColorSelection.SetColor(_colorPalette.Red, _colorPalette.Green, _colorPalette.Blue);
        }

        protected override void OnClick()
        {
            if (_colorPalette.IsColorSelected() == true)
            {
                ColorSelection.SetColor(_colorPalette.Red, _colorPalette.Green, _colorPalette.Blue);
            }      
        }

        protected override void OnUpdate()
        {
            Enabled = ArcGlobe.Application != null;
        }
    }
}

[Visual Basic .NET]

ColorCommand.vb

Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports System.IO
Imports ESRI.ArcGIS.ADF.BaseClasses
Imports ESRI.ArcGIS.ADF.CATIDs
Imports System.Windows.Forms


Namespace GlobeGraphicsToolbar
	Public Class ColorCommand
		Inherits ESRI.ArcGIS.Desktop.AddIns.Button
		Private _colorPalette As ColorPalette = Nothing

		Public Sub New()
			_colorPalette = New ColorPalette()

			ColorSelection.SetColor(_colorPalette.Red, _colorPalette.Green, _colorPalette.Blue)
		End Sub

		Protected Overrides Sub OnClick()
			If _colorPalette.IsColorSelected() = True Then
				ColorSelection.SetColor(_colorPalette.Red, _colorPalette.Green, _colorPalette.Blue)
			End If
		End Sub

		Protected Overrides Sub OnUpdate()
			Enabled = ArcGlobe.Application IsNot Nothing
		End Sub
	End Class
End Namespace