ArcObjects Library Reference

Add Event Wiring for All IActiveViewEvents Snippet

Add Event Wiring for All IActiveViewEvents. Default member variables are declared and all events are wired by calling a set up function. Events can be removed by calling another remove function. Code functions are stubbed out for adding custom actions for the events.

[C#]

/// <summary>
/// SECTION: Declare Event Handlers
/// </summary>
/// <remarks>
/// Variables are prefixed with an 'm_' denoting that they are member variables. 
/// This means they are global in scope for this class.
/// </remarks>
private ESRI.ArcGIS.Carto.IActiveViewEvents_AfterDrawEventHandler m_ActiveViewEventsAfterDraw;
private ESRI.ArcGIS.Carto.IActiveViewEvents_AfterItemDrawEventHandler m_ActiveViewEventsAfterItemDraw;
private ESRI.ArcGIS.Carto.IActiveViewEvents_ContentsChangedEventHandler m_ActiveViewEventsContentsChanged;
private ESRI.ArcGIS.Carto.IActiveViewEvents_ContentsClearedEventHandler m_ActiveViewEventsContentsCleared;
private ESRI.ArcGIS.Carto.IActiveViewEvents_FocusMapChangedEventHandler m_ActiveViewEventsFocusMapChanged;
private ESRI.ArcGIS.Carto.IActiveViewEvents_ItemAddedEventHandler m_ActiveViewEventsItemAdded;
private ESRI.ArcGIS.Carto.IActiveViewEvents_ItemDeletedEventHandler m_ActiveViewEventsItemDeleted;
private ESRI.ArcGIS.Carto.IActiveViewEvents_ItemReorderedEventHandler m_ActiveViewEventsItemReordered;
private ESRI.ArcGIS.Carto.IActiveViewEvents_SelectionChangedEventHandler m_ActiveViewEventsSelectionChanged;
private ESRI.ArcGIS.Carto.IActiveViewEvents_SpatialReferenceChangedEventHandler m_ActiveViewEventsSpatialReferenceChanged;
private ESRI.ArcGIS.Carto.IActiveViewEvents_ViewRefreshedEventHandler m_ActiveViewEventsViewRefreshed;


/// <summary>
/// SECTION: Set up the event handlers for all of the IActiveViewEvents
/// </summary>
/// <param name="map">An IMap interface for which to set up Event Handlers for</param>
/// <remarks>You do not have to set up Event Handlers for every event. You can pick and 
/// choose which ones you want to use.</remarks>
private void SetupActiveViewEvents(ESRI.ArcGIS.Carto.IMap map)
{
  //parameter check
  if(map == null)
  {
    return;
    
  }
  ESRI.ArcGIS.Carto.IActiveViewEvents_Event activeViewEvents = map as ESRI.ArcGIS.Carto.IActiveViewEvents_Event;
  // Create an instance of the delegate, add it to AfterDraw event
  m_ActiveViewEventsAfterDraw = new ESRI.ArcGIS.Carto.IActiveViewEvents_AfterDrawEventHandler(OnActiveViewEventsAfterDraw);
  activeViewEvents.AfterDraw += m_ActiveViewEventsAfterDraw;

  // Create an instance of the delegate, add it to AfterItemDraw event
  m_ActiveViewEventsAfterItemDraw = new ESRI.ArcGIS.Carto.IActiveViewEvents_AfterItemDrawEventHandler(OnActiveViewEventsItemDraw);
  activeViewEvents.AfterItemDraw += m_ActiveViewEventsAfterItemDraw;

  // Create an instance of the delegate, add it to ContentsChanged event
  m_ActiveViewEventsContentsChanged = new ESRI.ArcGIS.Carto.IActiveViewEvents_ContentsChangedEventHandler(OnActiveViewEventsContentsChanged);
  activeViewEvents.ContentsChanged += m_ActiveViewEventsContentsChanged;

  // Create an instance of the delegate, add it to ContentsCleared event
  m_ActiveViewEventsContentsCleared = new ESRI.ArcGIS.Carto.IActiveViewEvents_ContentsClearedEventHandler(OnActiveViewEventsContentsCleared);
  activeViewEvents.ContentsCleared += m_ActiveViewEventsContentsCleared;

  // Create an instance of the delegate, add it to FocusMapChanged event
  m_ActiveViewEventsFocusMapChanged = new ESRI.ArcGIS.Carto.IActiveViewEvents_FocusMapChangedEventHandler(OnActiveViewEventsFocusMapChanged);
  activeViewEvents.FocusMapChanged += m_ActiveViewEventsFocusMapChanged;

  // Create an instance of the delegate, add it to ItemAdded event
  m_ActiveViewEventsItemAdded = new ESRI.ArcGIS.Carto.IActiveViewEvents_ItemAddedEventHandler(OnActiveViewEventsItemAdded);
  activeViewEvents.ItemAdded += m_ActiveViewEventsItemAdded;

  // Create an instance of the delegate, add it to ItemDeleted event
  m_ActiveViewEventsItemDeleted = new ESRI.ArcGIS.Carto.IActiveViewEvents_ItemDeletedEventHandler(OnActiveViewEventsItemDeleted);
  activeViewEvents.ItemDeleted += m_ActiveViewEventsItemDeleted;

  // Create an instance of the delegate, add it to ItemReordered event
  m_ActiveViewEventsItemReordered = new ESRI.ArcGIS.Carto.IActiveViewEvents_ItemReorderedEventHandler(OnActiveViewEventsItemReordered);
  activeViewEvents.ItemReordered += m_ActiveViewEventsItemReordered;

  // Create an instance of the delegate, add it to SelectionChanged event
  m_ActiveViewEventsSelectionChanged = new ESRI.ArcGIS.Carto.IActiveViewEvents_SelectionChangedEventHandler(OnActiveViewEventsSelectionChanged);
  activeViewEvents.SelectionChanged += m_ActiveViewEventsSelectionChanged;

  // Create an instance of the delegate, add it to SpatialReferenceChanged event
  m_ActiveViewEventsSpatialReferenceChanged = new ESRI.ArcGIS.Carto.IActiveViewEvents_SpatialReferenceChangedEventHandler(OnActiveViewEventsSpatialReferenceChanged);
  activeViewEvents.SpatialReferenceChanged += m_ActiveViewEventsSpatialReferenceChanged;

  // Create an instance of the delegate, add it to ViewRefreshed event
  m_ActiveViewEventsViewRefreshed = new ESRI.ArcGIS.Carto.IActiveViewEvents_ViewRefreshedEventHandler(OnActiveViewEventsViewRefreshed);
  activeViewEvents.ViewRefreshed += m_ActiveViewEventsViewRefreshed;
}

/// <summary>
/// SECTION: Remove the event handlers for all of the IActiveViewEvents
/// </summary>
/// <param name="map">An IMap interface for which Event Handlers to remove.</param>
/// <remarks>You do not have to remove Event Handlers for every event. You can pick and 
/// choose which ones you want to use.</remarks>
private void RemoveActiveViewEvents(ESRI.ArcGIS.Carto.IMap map)
{

  //parameter check
  if (map == null)
  {
    return;

  }
  ESRI.ArcGIS.Carto.IActiveViewEvents_Event activeViewEvents = map as ESRI.ArcGIS.Carto.IActiveViewEvents_Event;

  // Remove AfterDraw Event Handler
  activeViewEvents.AfterDraw -= m_ActiveViewEventsAfterDraw;

  // Remove AfterItemDraw Event Handler
  activeViewEvents.AfterItemDraw -= m_ActiveViewEventsAfterItemDraw;

  // Remove ContentsChanged Event Handler
  activeViewEvents.ContentsChanged -= m_ActiveViewEventsContentsChanged;

  // Remove ContentsCleared Event Handler
  activeViewEvents.ContentsCleared -= m_ActiveViewEventsContentsCleared;

  // Remove FocusMapChanged Event Handler
  activeViewEvents.FocusMapChanged -= m_ActiveViewEventsFocusMapChanged;

  // Remove ItemAdded Event Handler
  activeViewEvents.ItemAdded -= m_ActiveViewEventsItemAdded;

  // Remove ItemDeleted Event Handler
  activeViewEvents.ItemDeleted -= m_ActiveViewEventsItemDeleted;

  // Remove ItemReordered Event Handler
  activeViewEvents.ItemReordered -= m_ActiveViewEventsItemReordered;

  // Remove SelectionChanged Event Handler
  activeViewEvents.SelectionChanged -= m_ActiveViewEventsSelectionChanged;

  // Remove SpatialReferenceChanged Event Handler
  activeViewEvents.SpatialReferenceChanged -= m_ActiveViewEventsSpatialReferenceChanged;

  // Remove ViewRefreshed Event Handler
  activeViewEvents.ViewRefreshed -= m_ActiveViewEventsViewRefreshed;
}

/// <summary>
/// AfterDraw Event handler
/// </summary>
/// <param name="Display"></param>
/// <param name="phase"></param>
/// <remarks>SECTION: Custom Functions that you write to add additionally functionality for the events</remarks>
private void OnActiveViewEventsAfterDraw(ESRI.ArcGIS.Display.IDisplay display, ESRI.ArcGIS.Carto.esriViewDrawPhase phase)
{
  // TODO: Add your code here
  // System.Windows.Forms.MessageBox.Show("AfterDraw"); 
}

/// <summary>
/// ItemDraw Event handler
/// </summary>
/// <param name="Index"></param>
/// <param name="Display"></param>
/// <param name="phase"></param>
/// <remarks></remarks>
private void OnActiveViewEventsItemDraw(short Index, ESRI.ArcGIS.Display.IDisplay display, ESRI.ArcGIS.esriSystem.esriDrawPhase phase)
{
  // TODO: Add your code here
  // System.Windows.Forms.MessageBox.Show("ItemDraw"); 
}

/// <summary>
/// ContentsChanged Event handler
/// </summary>
/// <remarks></remarks>
private void OnActiveViewEventsContentsChanged()
{
  // TODO: Add your code here
  // System.Windows.Forms.MessageBox.Show("ContentsChanged"); 
}

/// <summary>
/// ContentsCleared Event handler
/// </summary>
/// <remarks></remarks>
private void OnActiveViewEventsContentsCleared()
{
  // TODO: Add your code here
  // System.Windows.Forms.MessageBox.Show("ContentsCleared"); 
}

/// <summary>
/// FocusMapChanged Event handler
/// </summary>
/// <remarks></remarks>
private void OnActiveViewEventsFocusMapChanged()
{
  // TODO: Add your code here
  // System.Windows.Forms.MessageBox.Show("FocusMapChanged"); 
}

/// <summary>
/// ItemAdded Event handler
/// </summary>
/// <param name="Item"></param>
/// <remarks></remarks>
private void OnActiveViewEventsItemAdded(System.Object Item)
{
  // TODO: Add your code here
  // System.Windows.Forms.MessageBox.Show("ItemAdded"); 
}

/// <summary>
/// ItemDeleted Event handler
/// </summary>
/// <param name="Item"></param>
/// <remarks></remarks>
private void OnActiveViewEventsItemDeleted(System.Object Item)
{
  // TODO: Add your code here
  // System.Windows.Forms.MessageBox.Show("ItemDeleted"); 
}

/// <summary>
/// ItemReordered Event handler
/// </summary>
/// <param name="Item"></param>
/// <param name="toIndex"></param>
/// <remarks></remarks>
private void OnActiveViewEventsItemReordered(System.Object Item, System.Int32 toIndex)
{
  // TODO: Add your code here
  // System.Windows.Forms.MessageBox.Show("ItemReordered"); 
}

/// <summary>
/// SelectionChanged Event handler
/// </summary>
/// <remarks></remarks>
private void OnActiveViewEventsSelectionChanged()
{
  // TODO: Add your code here
  // System.Windows.Forms.MessageBox.Show("SelectionChanged"); 
}

/// <summary>
/// SpatialReferenceChanged Event handler
/// </summary>
/// <remarks></remarks>
private void OnActiveViewEventsSpatialReferenceChanged()
{
  // TODO: Add your code here
  // System.Windows.Forms.MessageBox.Show("SpatialReferenceChanged"); 
}

/// <summary>
/// ViewRefreshed Event handler
/// </summary>
/// <param name="view"></param>
/// <param name="phase"></param>
/// <param name="data"></param>
/// <param name="envelope"></param>
/// <remarks></remarks>
private void OnActiveViewEventsViewRefreshed(ESRI.ArcGIS.Carto.IActiveView view, ESRI.ArcGIS.Carto.esriViewDrawPhase phase, System.Object data, ESRI.ArcGIS.Geometry.IEnvelope envelope)
{
  // TODO: Add your code here
  // System.Windows.Forms.MessageBox.Show("ViewRefreshed");
}
[Visual Basic .NET]

''' <summary>
''' SECTION: Declare Event Handlers
''' </summary>
''' <remarks>
''' Variables are prefixed with an 'm_' denoting that they are member variables. 
''' This means they are global in scope for this class.
''' </remarks>
Private m_ActiveViewEventsAfterDraw As ESRI.ArcGIS.Carto.IActiveViewEvents_AfterDrawEventHandler
Private m_ActiveViewEventsAfterItemDraw As ESRI.ArcGIS.Carto.IActiveViewEvents_AfterItemDrawEventHandler
Private m_ActiveViewEventsContentsChanged As ESRI.ArcGIS.Carto.IActiveViewEvents_ContentsChangedEventHandler
Private m_ActiveViewEventsContentsCleared As ESRI.ArcGIS.Carto.IActiveViewEvents_ContentsClearedEventHandler
Private m_ActiveViewEventsFocusMapChanged As ESRI.ArcGIS.Carto.IActiveViewEvents_FocusMapChangedEventHandler
Private m_ActiveViewEventsItemAdded As ESRI.ArcGIS.Carto.IActiveViewEvents_ItemAddedEventHandler
Private m_ActiveViewEventsItemDeleted As ESRI.ArcGIS.Carto.IActiveViewEvents_ItemDeletedEventHandler
Private m_ActiveViewEventsItemReordered As ESRI.ArcGIS.Carto.IActiveViewEvents_ItemReorderedEventHandler
Private m_ActiveViewEventsSelectionChanged As ESRI.ArcGIS.Carto.IActiveViewEvents_SelectionChangedEventHandler
Private m_ActiveViewEventsSpatialReferenceChanged As ESRI.ArcGIS.Carto.IActiveViewEvents_SpatialReferenceChangedEventHandler
Private m_ActiveViewEventsViewRefreshed As ESRI.ArcGIS.Carto.IActiveViewEvents_ViewRefreshedEventHandler


''' <summary>
''' SECTION: Set up the event handlers for all of the IActiveViewEvents
''' </summary>
''' <param name="map">An IMap interface for which to set up Event Handlers for</param>
''' <remarks>You do not have to set up Event Handlers for every event. You can pick and 
''' choose which ones you want to use.</remarks>
Private Sub SetupActiveViewEvents(ByVal map As ESRI.ArcGIS.Carto.IMap)

  If map Is Nothing Then
    Return
  End If

  Dim activeViewEvents As ESRI.ArcGIS.Carto.IActiveViewEvents_Event = TryCast(map, ESRI.ArcGIS.Carto.IActiveViewEvents_Event)

  'Create an instance of the delegate, add it to AfterDraw event
  m_ActiveViewEventsAfterDraw = New ESRI.ArcGIS.Carto.IActiveViewEvents_AfterDrawEventHandler(AddressOf OnActiveViewEventsAfterDraw)
  AddHandler activeViewEvents.AfterDraw, m_ActiveViewEventsAfterDraw

  'Create an instance of the delegate, add it to AfterItemDraw event
  m_ActiveViewEventsAfterItemDraw = New ESRI.ArcGIS.Carto.IActiveViewEvents_AfterItemDrawEventHandler(AddressOf OnActiveViewEventsItemDraw)
  AddHandler activeViewEvents.AfterItemDraw, m_ActiveViewEventsAfterItemDraw

  'Create an instance of the delegate, add it to ContentsChanged event
  m_ActiveViewEventsContentsChanged = New ESRI.ArcGIS.Carto.IActiveViewEvents_ContentsChangedEventHandler(AddressOf OnActiveViewEventsContentsChanged)
  AddHandler activeViewEvents.ContentsChanged, m_ActiveViewEventsContentsChanged

  'Create an instance of the delegate, add it to ContentsCleared event
  m_ActiveViewEventsContentsCleared = New ESRI.ArcGIS.Carto.IActiveViewEvents_ContentsClearedEventHandler(AddressOf OnActiveViewEventsContentsCleared)
  AddHandler activeViewEvents.ContentsCleared, m_ActiveViewEventsContentsCleared

  'Create an instance of the delegate, add it to FocusMapChanged event
  m_ActiveViewEventsFocusMapChanged = New ESRI.ArcGIS.Carto.IActiveViewEvents_FocusMapChangedEventHandler(AddressOf OnActiveViewEventsFocusMapChanged)
  AddHandler activeViewEvents.FocusMapChanged, m_ActiveViewEventsFocusMapChanged

  'Create an instance of the delegate, add it to ItemAdded event
  m_ActiveViewEventsItemAdded = New ESRI.ArcGIS.Carto.IActiveViewEvents_ItemAddedEventHandler(AddressOf OnActiveViewEventsItemAdded)
  AddHandler activeViewEvents.ItemAdded, m_ActiveViewEventsItemAdded

  'Create an instance of the delegate, add it to ItemDeleted event
  m_ActiveViewEventsItemDeleted = New ESRI.ArcGIS.Carto.IActiveViewEvents_ItemDeletedEventHandler(AddressOf OnActiveViewEventsItemDeleted)
  AddHandler activeViewEvents.ItemDeleted, m_ActiveViewEventsItemDeleted

  'Create an instance of the delegate, add it to ItemReordered event
  m_ActiveViewEventsItemReordered = New ESRI.ArcGIS.Carto.IActiveViewEvents_ItemReorderedEventHandler(AddressOf OnActiveViewEventsItemReordered)
  AddHandler activeViewEvents.ItemReordered, m_ActiveViewEventsItemReordered

  'Create an instance of the delegate, add it to SelectionChanged event
  m_ActiveViewEventsSelectionChanged = New ESRI.ArcGIS.Carto.IActiveViewEvents_SelectionChangedEventHandler(AddressOf OnActiveViewEventsSelectionChanged)
  AddHandler activeViewEvents.SelectionChanged, m_ActiveViewEventsSelectionChanged

  'Create an instance of the delegate, add it to SpatialReferenceChanged event
  m_ActiveViewEventsSpatialReferenceChanged = New ESRI.ArcGIS.Carto.IActiveViewEvents_SpatialReferenceChangedEventHandler(AddressOf OnActiveViewEventsSpatialReferenceChanged)
  AddHandler activeViewEvents.SpatialReferenceChanged, m_ActiveViewEventsSpatialReferenceChanged

  'Create an instance of the delegate, add it to ViewRefreshed event
  m_ActiveViewEventsViewRefreshed = New ESRI.ArcGIS.Carto.IActiveViewEvents_ViewRefreshedEventHandler(AddressOf OnActiveViewEventsViewRefreshed)
  AddHandler activeViewEvents.ViewRefreshed, m_ActiveViewEventsViewRefreshed
End Sub

''' <summary>
''' SECTION: Remove the event handlers for all of the IActiveViewEvents
''' </summary>
''' <param name="map">An IMap interface for which Event Handlers to remove.</param>
''' <remarks>You do not have to remove Event Handlers for every event. You can pick and 
''' choose which ones you want to use.</remarks>
Private Sub RemoveActiveViewEvents(ByVal map As ESRI.ArcGIS.Carto.IMap)

  'parameter check
  If map Is Nothing Then
    Return
  End If

  Dim activeViewEvents As ESRI.ArcGIS.Carto.IActiveViewEvents_Event = TryCast(map, ESRI.ArcGIS.Carto.IActiveViewEvents_Event)

  ' Remove AfterDraw Event Handler
  RemoveHandler activeViewEvents.AfterDraw, m_ActiveViewEventsAfterDraw

  ' Remove AfterItemDraw Event Handler
  RemoveHandler activeViewEvents.AfterItemDraw, m_ActiveViewEventsAfterItemDraw

  ' Remove ContentsChanged Event Handler
  RemoveHandler activeViewEvents.ContentsChanged, m_ActiveViewEventsContentsChanged

  ' Remove ContentsCleared Event Handler
  RemoveHandler activeViewEvents.ContentsCleared, m_ActiveViewEventsContentsCleared

  ' Remove FocusMapChanged Event Handler
  RemoveHandler activeViewEvents.FocusMapChanged, m_ActiveViewEventsFocusMapChanged

  ' Remove ItemAdded Event Handler
  RemoveHandler activeViewEvents.ItemAdded, m_ActiveViewEventsItemAdded

  ' Remove ItemDeleted Event Handler
  RemoveHandler activeViewEvents.ItemDeleted, m_ActiveViewEventsItemDeleted

  ' Remove ItemReordered Event Handler
  RemoveHandler activeViewEvents.ItemReordered, m_ActiveViewEventsItemReordered

  ' Remove SelectionChanged Event Handler
  RemoveHandler activeViewEvents.SelectionChanged, m_ActiveViewEventsSelectionChanged

  ' Remove SpatialReferenceChanged Event Handler
  RemoveHandler activeViewEvents.SpatialReferenceChanged, m_ActiveViewEventsSpatialReferenceChanged

  ' Remove ViewRefreshed Event Handler
  RemoveHandler activeViewEvents.ViewRefreshed, m_ActiveViewEventsViewRefreshed

End Sub

''' <summary>
''' AfterDraw Event handler
''' </summary>
''' <param name="Display"></param>
''' <param name="phase"></param>
''' <remarks>SECTION: Custom Functions that you write to add additionally functionality for the events</remarks>
Private Sub OnActiveViewEventsAfterDraw(ByVal display As ESRI.ArcGIS.Display.IDisplay, ByVal phase As ESRI.ArcGIS.Carto.esriViewDrawPhase)
  ' TODO: Add your code here
  ' System.Windows.Forms.MessageBox.Show("AfterDraw")
End Sub

''' <summary>
''' ItemDraw Event handler
''' </summary>
''' <param name="Index"></param>
''' <param name="Display"></param>
''' <param name="phase"></param>
''' <remarks></remarks>
Private Sub OnActiveViewEventsItemDraw(ByVal Index As System.Int16, ByVal display As ESRI.ArcGIS.Display.IDisplay, ByVal phase As ESRI.ArcGIS.esriSystem.esriDrawPhase)
  ' TODO: Add your code here
  ' System.Windows.Forms.MessageBox.Show("ItemDraw") 
End Sub

''' <summary>
''' ContentsChanged Event handler
''' </summary>
''' <remarks></remarks>
Private Sub OnActiveViewEventsContentsChanged()
  ' TODO: Add your code here
  ' System.Windows.Forms.MessageBox.Show("ContentsChanged") 
End Sub

''' <summary>
''' ContentsCleared Event handler
''' </summary>
''' <remarks></remarks>
Private Sub OnActiveViewEventsContentsCleared()
  ' TODO: Add your code here
  ' System.Windows.Forms.MessageBox.Show("ContentsCleared") 
End Sub

''' <summary>
''' FocusMapChanged Event handler
''' </summary>
''' <remarks></remarks>
Private Sub OnActiveViewEventsFocusMapChanged()
  ' TODO: Add your code here
  ' System.Windows.Forms.MessageBox.Show("FocusMapChanged") 
End Sub

''' <summary>
''' ItemAdded Event handler
''' </summary>
''' <param name="Item"></param>
''' <remarks></remarks>
Private Sub OnActiveViewEventsItemAdded(ByVal Item As System.Object)
  ' TODO: Add your code here
  ' System.Windows.Forms.MessageBox.Show("ItemAdded") 
End Sub

''' <summary>
''' ItemDeleted Event handler
''' </summary>
''' <param name="Item"></param>
''' <remarks></remarks>
Private Sub OnActiveViewEventsItemDeleted(ByVal Item As System.Object)
  ' TODO: Add your code here
  ' System.Windows.Forms.MessageBox.Show("ItemDeleted") 
End Sub

''' <summary>
''' ItemReordered Event handler
''' </summary>
''' <param name="Item"></param>
''' <param name="toIndex"></param>
''' <remarks></remarks>
Private Sub OnActiveViewEventsItemReordered(ByVal Item As System.Object, ByVal toIndex As System.Int32)
  ' TODO: Add your code here
  ' System.Windows.Forms.MessageBox.Show("ItemReordered") 
End Sub

''' <summary>
''' SelectionChanged Event handler
''' </summary>
''' <remarks></remarks>
Private Sub OnActiveViewEventsSelectionChanged()
  ' TODO: Add your code here
  ' System.Windows.Forms.MessageBox.Show("SelectionChanged") 
End Sub

''' <summary>
''' SpatialReferenceChanged Event handler
''' </summary>
''' <remarks></remarks>
Private Sub OnActiveViewEventsSpatialReferenceChanged()
  ' TODO: Add your code here
  ' System.Windows.Forms.MessageBox.Show("SpatialReferenceChanged") 
End Sub

''' <summary>
''' ViewRefreshed Event handler
''' </summary>
''' <param name="view"></param>
''' <param name="phase"></param>
''' <param name="data"></param>
''' <param name="envelope"></param>
''' <remarks></remarks>
Private Sub OnActiveViewEventsViewRefreshed(ByVal view As ESRI.ArcGIS.Carto.IActiveView, ByVal phase As ESRI.ArcGIS.Carto.esriViewDrawPhase, ByVal data As System.Object, ByVal envelope As ESRI.ArcGIS.Geometry.IEnvelope)
  ' TODO: Add your code here
  ' System.Windows.Forms.MessageBox.Show("ViewRefreshed") 
End Sub


Additional Requirements
  • The code in this document requires the following References added to the Visual Studio project:
  • ESRI.ArcGIS.Carto
  • ESRI.ArcGIS.Display
  • ESRI.ArcGIS.Geometry
  • ESRI.ArcGIS.System