DockWindow.vb
' Copyright 2010 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. ' Imports System Imports System.Collections.Generic Imports System.ComponentModel Imports System.Data Imports System.Drawing Imports System.Linq Imports System.Text Imports System.Windows.Forms Imports ESRI.ArcGISExplorer Imports ESRI.ArcGISExplorer.Application Imports ESRI.ArcGISExplorer.Mapping Imports ESRI.ArcGISExplorer.Geometry Imports ESRI.ArcGISExplorer.Data Imports ESRI.ArcGISExplorer.Threading Public Class DockWindow Inherits ESRI.ArcGISExplorer.Application.DockWindow Public Sub New() InitializeComponent() End Sub Private Sub btnPoint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPoint.Click Dim md As MapDisplay = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay 'Track Point Dim trackedPoint As ESRI.ArcGISExplorer.Geometry.Point = md.TrackPoint() 'Turn Point To Graphic Dim trackedGraphic As Graphic = 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 Dim title As String = trackedPoint.GeometryType.ToString() & " with center at " & trackedPoint.X & ", " & trackedPoint.Y 'Add the Point coordinates to the TreeView GraphicToTreeView(trackedGraphic, title) End Sub Private Sub GraphicToTreeView(ByVal trackedGraphic As Graphic, ByVal title As String) tvTrackedGeometries.BeginUpdate() 'Create a new tree node with the Point's coordinates as the title Dim tn As TreeNode = New TreeNode(title) 'Add the new tree node to the tree view tvTrackedGeometries.Nodes.Insert(tvTrackedGeometries.Nodes.Count, tn) tvTrackedGeometries.EndUpdate() tvTrackedGeometries.Refresh() End Sub End Class