Gets or sets an icon shown in the Gallery; often a visual representation of the action or effect of choosing this specific GalleryItem.

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 Image Image { get; set; }
Visual Basic (Declaration)
Public Property Image As Image

Field Value

A Image used to display the GalleryItem in the Ribbon.

Remarks

Each GalleryItem has an image - an icon indicating the action or effect of choosing this specific GalleryItem. The Image is displayed above the Caption in the Gallery. Although it is recommended that each GalleryItem have both a valid Caption and Image, the Image can be null, in which case only the Caption is displayed.

Although Images in a Gallery may be identical, it is recommended that the image used is a visual representation of the action or effect of choosing this specific GalleryItem, and therefore that images are different for each GalleryItem, to help the user identify each item from the other items.

Images can very simply be created using the static methods on the Image class which allow an image to be created from various sources; the example code below demonstrates the use of the FromFile(String) method to create an Image from a path to an image file. Alternatively, create a Bitmap, which can be cast to an Image can therefore be set into the Image property.

Examples

The example code below shows a very simple Gallery class which displays 3 items; clicking on each item will zoom the display so that a specific location is in the center of the map, and the current altitude/map scale is maintained.
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 NewGallery
{
  public class NewGallery : ESRI.ArcGISExplorer.Application.Gallery
  {

    public NewGallery()
    {
      // Read in an image from the icons installed with the SDK to use as an icon.
      string imgPath = Environment.GetEnvironmentVariable("ArcGIS_E3SDK") + @"\Icons\View32.png";
      Image btnImage = Image.FromFile(imgPath);

      // Add some items to the gallery.
      this.Items.Add(new GalleryItem("Redlands", btnImage, "View Redlands, CA, USA"));
      this.Items.Add(new GalleryItem("Edinburgh", btnImage, "View Edinburgh, UK"));
      this.Items.Add(new GalleryItem("Portland", btnImage, "View Portland, ME, USA"));
    }

    public override void OnClick(GalleryItem item)
    {
      // Work out which item was clicked.
      ESRI.ArcGISExplorer.Geometry.Point location = null;
      if (item.Caption.StartsWith("Redlands"))
      {
        location = new ESRI.ArcGISExplorer.Geometry.Point(-117.171315683414, 34.0502770959205);
      }
      else if (item.Caption.StartsWith("Edinburgh"))
      {
        location = new ESRI.ArcGISExplorer.Geometry.Point(-3.19999077085197, 55.9500400262958);
      }
      else if (item.Caption.StartsWith("Portland"))
      {
        location = new ESRI.ArcGISExplorer.Geometry.Point(-70.2624358181778, 43.6546676468125);
      }
      // Zoom to the location, maintaining altitude / map scale.
      MapDisplay disp = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay;
      double alt = disp.Altitude;
      disp.ZoomTo(location, alt);
    }
  }
}
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 NewGallery
  Inherits ESRI.ArcGISExplorer.Application.Gallery

  Public Sub New()
    ' Read in an image from the icons installed with the SDK to use as an icon.
    Dim imgPath As String = Environment.GetEnvironmentVariable("ArcGIS_E3SDK") & "\Icons\View32.png"
    Dim btnImage As Image = Image.FromFile(imgPath)

    ' Add some items to the gallery.
    Me.Items.Add(New GalleryItem("Redlands", btnImage, "View Redlands, CA, USA"))
    Me.Items.Add(New GalleryItem("Edinburgh", btnImage, "View Edinburgh, UK"))
    Me.Items.Add(New GalleryItem("Portland", btnImage, "View Portland, ME, USA"))

  End Sub

  Public Overrides Sub OnClick(ByVal item As GalleryItem)
    ' Work out which item was clicked.
    Dim location As ESRI.ArcGISExplorer.Geometry.Point = Nothing
    If (item.Caption.StartsWith("Redlands")) Then
      location = New ESRI.ArcGISExplorer.Geometry.Point(-117.171315683414, 34.0502770959205)
    ElseIf (item.Caption.StartsWith("Edinburgh")) Then
      location = New ESRI.ArcGISExplorer.Geometry.Point(-3.19999077085197, 55.9500400262958)
    ElseIf (item.Caption.StartsWith("Portland")) Then
      location = New ESRI.ArcGISExplorer.Geometry.Point(-70.2624358181778, 43.6546676468125)
    End If
        ' Zoom to the location, maintaining altitude / map scale.
    Dim disp As MapDisplay = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay
    Dim alt As Double = disp.Altitude
    disp.ZoomTo(location, alt)
  End Sub

End Class

See Also