1

I am upgrading a .NET application from ArcGIS 9.3 to ArcGIS 10.3. I've noticed that the map control behaves differently: the map no longer automatically rescales itself when the window is resized. To put it another way, when you resize the map the scale stays the same even though the extent changes. I would rather that the map rescaled when the window is resized, as it did under ArcGIS 9.3.

The commentary below from ESRI explains that this change is by design.

http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/What_s_new_for_map_display_and_navigation/00qp0000001w000000/

Less redrawing in data view

In previous versions of ArcMap, if you changed the size of the ArcMap display while working in data view, either by resizing the ArcMap window or by docking/undocking/resizing a dockable window, by default your map was completely redrawn to fit inside the available display area. So the scale changed and the extent stayed the same (although you may have seen some extra geographic coverage based on how well the extent fit inside the new shape of the display area). At version 10, the default drawing behavior in data view has been changed so that when the display size is changed, your map is no longer completely redrawn to fit inside the display. Instead, the scale stays the same and the extent will change. If you make the display bigger, you'll see a larger geographic extent, and vice versa.

This has the performance advantage that the portion of the display unaffected by resizing doesn't need to be redrawn at all. For example, if you close a docked window, only the portion of the display that was obscured by the window needs to be redrawn. It is also easier to work with the display because geographic features on your map don't move around as you dock and undock windows. Features on your map remain in the same location in the display until you manually pan or zoom the map.

In summary: I want the ArcGIS 10 map in my .NET application to rescale when the window is resized, just as it did under ArcGIS 9.3.

  • @Dan-Jurgella Yes, it is interesting that even the option in ArcMap was removed. So in fact the new 'default' behaviour is the only behaviour. – EleventhDoctor May 14 '15 at 12:43
  • 1
    Ah sorry, I had deleted my comment after I saw that you had reiterated in the original post that it was by design. Bacically I had also pointed out that they removed the option, which I also think is very unfortunate. – Dan Jurgella May 14 '15 at 12:47
1
+50

The IScreenDisplay interface has a ScaleContents property; set it to True and the old behavior is back.

My.ArcMap.Document.ActiveView.ScreenDisplay.ScaleContents = True

This works as a button click event in ArcMap, though I'll probably create an extension that the user can enable or disable. Hopefully it will also work in your application.

  • I'd +100 this if I could - very helpful intervention, thank you. Works very nicely for me. – EleventhDoctor May 18 '15 at 11:24
  • 1
    For me, the line of code would read: mapControl.ActiveView.ScreenDisplay.ScaleContents = True. – EleventhDoctor May 18 '15 at 14:38
0

When the form is resized at run time, the PageLayoutControl and MapControl do not automatically resize. To resize the controls so that they always fill the extent of the form, anchor the controls to the form.

enter image description here

If the PageLayoutControl or MapControl contains a lot of data, redrawing this data while the form is resized can be costly. To increase performance, suppress the data redraw until the resizing is complete. During the resize, a stretched bitmap draws instead.

private void MapViewer_ResizeBegin(object sender, EventArgs e)
{
    //Suppress data redraw and draw bitmap instead.
    axMapControl1.SuppressResizeDrawing(true, 0);
    axPageLayoutControl1.SuppressResizeDrawing(true, 0);
}


private void MapViewer_ResizeEnd(object sender, EventArgs e){
    //Stop bitmap draw and draw data.
    axMapControl1.SuppressResizeDrawing(false, 0);
    axPageLayoutControl1.SuppressResizeDrawing(false, 0);}

Update: There is a similar thread already solved in SE. Maybe it solves yours!

AxMapControl painting issue

  • Thank you @Farid-Cher. However the issue I am having is that while the map control does resize (it is anchored properly :-) ), the map does not rescale itself. What I want is for the map to automatically rescale when resizing as it does with ArcGIS 9.3. If you create a simple application with a map control on 9.3 and on 10(.x), and place them alongside each other, you can see the difference in behaviour. I'll add a clarifying comment to my question. – EleventhDoctor May 14 '15 at 12:03
  • Check the updated answer. – Farid Cheraghi May 14 '15 at 12:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.