Called when the button is clicked.

Namespace:  ESRI.ArcGISExplorer.Application

Assembly:  ESRI.ArcGISExplorer.Application (in ESRI.ArcGISExplorer.Application.dll) Version: 2.0.0.1500 (2.0.0.1500)

Syntax

C#
public virtual void OnClick()
Visual Basic (Declaration)
Public Overridable Sub OnClick

Remarks

Override the OnClick method to run code when the user clicks the button on the Ribbon. The majority of code in a custom Button is generally found in this method.

Examples

The example code below shows a very simple Button class which shows a message to the user indicating the current display mode when the user clicks the Button.
CopyC#
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");
    }
  }
}
CopyVB.NET
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

See Also