Skip to content

How to zoom to raster resolution? #16

@yh371174229

Description

@yh371174229

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#

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions