AnsweredAssumed Answered

Creating image of one layer within the active view

Question asked by dlamartina on Sep 19, 2018

I'm trying to get an image of just ONE layer within the active view, regardless of whatever other layers may be active.

 

The code snippet at http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/#/Create_JPEG_hi_resolution_from_ActiveView_Snippet/0049000000nv000000/ produces an image within the desired space, but of course all active features show up.

I've tried modifying the final portion thusly:

System.Int32 hDC = export.StartExporting();

ESRI.ArcGIS.Display.IDisplay display = new ESRI.ArcGIS.Display.SimpleDisplay();
display.StartDrawing((System.Int32)hDC, (short)esriScreenCache.esriScreenRecording);

IDocument doc = ArcMap.Application.Document;
IMxDocument mxDoc = doc as IMxDocument;
IMap map = mxDoc.FocusMap;
ILayer layer = map.get_Layer(1);

layer.Draw((ESRI.ArcGIS.esriSystem.esriDrawPhase)1, display, null);
display.FinishDrawing();          

activeView.Output(hDC, (System.Int16)export.Resolution, ref exportRECT, null, null); // Explicit Cast and 'ref' keyword needed
export.FinishExporting();
export.Cleanup();

to no avail. Any ideas as to how I can isolate just the active portion of one layer?

Outcomes