How can I create an IDynamicDisplay obj in ArcObjects?
I am trying to draw a text g开发者_开发知识库lyph on the map and all the tutorials say I need a IDynamicDisplay, but I don't know how to get at one. Thanks in advance. ; ) edit: C# VS2010
First you need to set IDynamicMap::DynamicMapEnabled property from Map object to true.
IDynamicMap pDynamicMap = pMap as IDynamicMap;
pDynamicMap.DynamicMapEnabled = true
Then, there are two ways to get DynamicDisplay object. One is creating custom Layer with implement IDynamicLayer interface. Second one is hooking IDynamicMapEvents::BeforeDynamicDraw event or IDynamicMapEvents::AfterDynamicDraw event. I hope this best practice help you.
Best practices for using dynamic display
You have to wire up an event handler
ESRI.ArcGIS.Carto.IDynamicMapEvents_Event dynamicMapEvents = dynamicMap as ESRI.ArcGIS.Carto.IDynamicMapEvents_Event;
ESRI.ArcGIS.Carto.IActiveViewEvents_Event avEvents = activeView as ESRI.ArcGIS.Carto.IActiveViewEvents_Event;
avEvents.AfterDraw += new ESRI.ArcGIS.Carto.IActiveViewEvents_AfterDrawEventHandler(avEvents_AfterDraw);
dynamicMapEvents.AfterDynamicDraw += new IDynamicMapEvents_AfterDynamicDrawEventHandler(dynamicMapEvents_AfterDynamicDraw);
精彩评论