Gallery Walkthrough
Gallery.cs
// Copyright 2011 ESRI
// 
// All rights reserved under the copyright laws of the United States
// and applicable international laws, treaties, and conventions.
// 
// You may freely redistribute and use this sample code, with or
// without modification, provided you include the original copyright
// notice and use restrictions.
// 
// See the use restrictions.
// 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;

using ESRI.ArcGISExplorer;
using ESRI.ArcGISExplorer.Application;
using ESRI.ArcGISExplorer.Mapping;
using ESRI.ArcGISExplorer.Geometry;
using ESRI.ArcGISExplorer.Data;
using ESRI.ArcGISExplorer.Threading;

namespace GalleryWalkthroughCS
{
    public class Gallery : ESRI.ArcGISExplorer.Application.Gallery
    {
        //Use the ArcGIS_E3SDK environment variable here. It points to the install 
        //location of the ArcGIS Explorer developer kit, i.e. C:\Program Files\Explorer\DeveloperKit.
        string _imgPath = Environment.GetEnvironmentVariable("ArcGIS_E3SDK") +
            "\\..\\Styles\\SymbolImages\\Points of Interest\\Information.png";

        public Gallery()
        {
            //Set the Gallery button Image and properties
            Image btnImage = Image.FromFile(_imgPath);
            GalleryItem myGalleryItem = new GalleryItem("MyGalleryItem", btnImage,
                "Click on the map to add graphic");
            this.Items.Add(myGalleryItem);
        }

        public override void OnClick(GalleryItem item)
        {
            MapDisplay md = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay;
            //Track the point on the map of the mouse click
            ESRI.ArcGISExplorer.Geometry.Point trackPoint = md.TrackPoint();
            //Turn the Point in to a Graphic
            Graphic pointGraphic = new Graphic(trackPoint);
            //Set the Graphic's symbol to the same as the Gallery Image (Access the Symbol through Marker).
            pointGraphic.Symbol = Symbol.Marker.PointsOfInterest.Information;
            //Add the Graphic to the Map Display            
            md.Graphics.Add(pointGraphic);
        }
    }
}