Assembly: ESRI.ArcGISExplorer.Application (in ESRI.ArcGISExplorer.Application.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public abstract class Button |
Visual Basic (Declaration) |
---|
Public MustInherit Class Button |
Remarks
The Button class provides the simplest extension point in ArcGIS Explorer. A class which inherits from the Button class can be shown as a button in the ArcGIS Explorer application Ribbon, providing an opportunity to run code. Other extension points are DockWindow, Gallery, CheckBox, ComboBox and Extension.
The simplest way to create a new Button is to use the templates provided in the Visual Studio Tools for ArcGIS Explorer. For step by step instructions on creating a new Button using these templates, see the Creating a custom Button walkthrough.
Override the OnClick()()() method to run code when the user clicks the button; the majority of code in a custom Button is generally found in this method. Optionally, override the OnUpdate()()() method to periodically run code; note that the OnUpdate method should only perform brief operations to maintain responsiveness of the application.
Note: |
---|
A Button must be included in an add-in project and described in the AddIns.xml file which is part of that project in order to be loaded by ArcGIS Explorer. These steps are automated if the Button is created by using the Visual Studio Tools for ArcGIS Explorer templates. |
Examples
using System; using System.Text; // Import some typical namespaces. using System.Windows.Forms; using System.Drawing; using ESRI.ArcGISExplorer.Application; using ESRI.ArcGISExplorer.Mapping; namespace NewButton { class NewButton : ESRI.ArcGISExplorer.Application.Button { public override void OnClick() { MapDisplay disp = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay; MessageBox.Show("The current map display mode is " + disp.DisplayMode.ToString(), "Current Display Mode"); } } }
Imports System Imports System.Text ' Import some typical namespaces. Imports System.Windows.Forms Imports System.Drawing ' Additional ArcGIS Explorer namespaces. Imports ESRI.ArcGISExplorer.Application Imports ESRI.ArcGISExplorer.Mapping Public Class NewButton Inherits ESRI.ArcGISExplorer.Application.Button Public Overrides Sub OnClick() Dim disp As MapDisplay = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay MessageBox.Show("The current map display mode is " & disp.DisplayMode.ToString(), "Current Display Mode") End Sub End Class