DockWindow.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 System.Windows.Forms; using ESRI.ArcGISExplorer; using ESRI.ArcGISExplorer.Application; using ESRI.ArcGISExplorer.Mapping; using ESRI.ArcGISExplorer.Geometry; using ESRI.ArcGISExplorer.Data; using ESRI.ArcGISExplorer.Threading; namespace DockWindowWalkthroughCS { public partial class DockWindow : ESRI.ArcGISExplorer.Application.DockWindow { public DockWindow() { InitializeComponent(); } private void btnPoint_Click(object sender, EventArgs e) { MapDisplay md = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay; //Track Point ESRI.ArcGISExplorer.Geometry.Point trackedPoint = md.TrackPoint(); //Turn Point To Graphic Graphic trackedGraphic = new Graphic(trackedPoint, Symbol.Marker.Pushpin.Red); //Add the Graphic to the Map Display md.Graphics.Add(trackedGraphic); //Create a string to hold the coordinates of the Point string title = trackedPoint.GeometryType.ToString() + " with center at " + trackedPoint.X + ", " + trackedPoint.Y; //Add the Point coordinates to the TreeView GraphicToTreeView(trackedGraphic, title); } private void GraphicToTreeView(Graphic trackedGraphic, string title) { tvTrackedGeometries.BeginUpdate(); //Create a new tree node with the Point's coordinates as the title TreeNode tn = new TreeNode(title); //Add the new tree node to the tree view tvTrackedGeometries.Nodes.Insert(tvTrackedGeometries.Nodes.Count, tn); tvTrackedGeometries.EndUpdate(); tvTrackedGeometries.Refresh(); } } }