Saturday, 7 September 2019

arcobjects - ArcMap - Strange Behavior When Trying To Wire IActiveViewEvents in IDockableWindow


I can't seem to wire up IActiveViewEvents for an IDockableWindow. I am using a straight out-of-the-box IDockableWindow which inherits BaseCommand. The snippet below shows what I have added to the autogenerated code. Problem is, when I try to run ArcMap, it (the main ArcMap GUI) never loads. Please see attached screenshot to see what I mean.bland arcmap gui


 public override void OnCreate(object hook)

{
if (hook != null)
m_application = hook as IApplication;

if (m_application != null)
{
SetupDockableWindow();
base.m_enabled = m_dockableWindow != null;
}
else

base.m_enabled = false;

IMxDocument mxDoc = (IMxDocument)m_application.Document;
IActiveViewEvents_Event activeViewEvents = mxDoc.ActiveView as IActiveViewEvents_Event;
activeViewEvents.ViewRefreshed += new IActiveViewEvents_ViewRefreshedEventHandler(activeViewEvents_ViewRefreshed);
}

void activeViewEvents_ViewRefreshed(IActiveView view, esriViewDrawPhase phase, object Data, ESRI.ArcGIS.Geometry.IEnvelope envelope)
{
MessageBox.Show("ViewRefreshed");

}


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...