ComboBoxWalkthrough.vb
' 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. ' Imports System Imports System.Collections.Generic Imports System.ComponentModel Imports System.Data Imports System.Drawing Imports System.Linq Imports System.Text Imports ESRI.ArcGISExplorer Imports ESRI.ArcGISExplorer.Application Imports ESRI.ArcGISExplorer.Geometry Imports ESRI.ArcGISExplorer.Mapping Imports ESRI.ArcGISExplorer.Data Imports ESRI.ArcGISExplorer.Threading Public Class ComboBoxWalkthrough Inherits ESRI.ArcGISExplorer.Application.ComboBox Public Sub New() 'add rotation options Dim itm As New ComboItem("45") itm = New ComboItem("45") itm.Tag = 45 Me.Items.Add(itm) itm = New ComboItem("90") itm.Tag = 90 Me.Items.Add(itm) itm = New ComboItem("135") itm.Tag = 135 Me.Items.Add(itm) itm = New ComboItem("180") itm.Tag = 180 Me.Items.Add(itm) itm = New ComboItem("225") itm.Tag = 225 Me.Items.Add(itm) itm = New ComboItem("270") itm.Tag = 270 Me.Items.Add(itm) itm = New ComboItem("315") itm.Tag = 315 Me.Items.Add(itm) End Sub Public Overrides Sub OnSelectionChange(ByVal item As ComboItem) If Me.SelectedItem IsNot Nothing Then Dim degrees As Double = Convert.ToDouble(item.Tag) ' grab the selected note Dim selItems As SelectedItemsCollection = ESRI.ArcGISExplorer.Application.Application.SelectedItems If (selItems.Count = 1) AndAlso (TypeOf selItems(0) Is Note) Then Dim selected As Note = TryCast(selItems(0), Note) ' Rotate the geometry Dim rotated As Geometry = GeometryOperations.Rotate(selected.Graphic.Geometry, (degrees * -1), Unit.Angular.Degrees) ' Update the geometry of the graphic. selected.Graphic.Geometry = rotated ' reset the selection of the combobox Me.SelectedItem = Nothing End If End If End Sub End Class