-
Notifications
You must be signed in to change notification settings - Fork 193
How to zoom to raster resolution? #16
Copy link
Copy link
Open
Description
I use this code,but it's not perfect solution
pActiveView.Extent = (pRasterLayer as IGeoDataset).Extent;
IntPtr pHandle = new IntPtr(pActiveView.ScreenDisplay.hWnd);
AxMapControl axMapControl1 = Form.FromHandle(pHandle) as AxMapControl;
int controlWidth = axMapControl1.Width;
double controlW = Convert.ToDouble(controlWidth);
IMap pMap = pActiveView.FocusMap;
pMap.MapScale = (controlW / pRasterLayer.ColumnCount * pMap.MapScale);
MessageBox.Show(pMap.MapScale.ToString());
pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
ArcGIS 10.6.1+C#
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Give feedbackNo fields configured for issues without a type.