Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to zoom to raster resolution? #16

Open
yh371174229 opened this issue Dec 23, 2019 · 0 comments
Open

How to zoom to raster resolution? #16

yh371174229 opened this issue Dec 23, 2019 · 0 comments

Comments

@yh371174229
Copy link

yh371174229 commented Dec 23, 2019

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#

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant