Open yh371174229 opened 4 years ago
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#
I use this code,but it's not perfect solution
ArcGIS 10.6.1+C#