3

Background:

I have a custom ArcGIS application written using ArcGIS Engine 10.0 that at its simplest form is just a map control inside of a resizeable form.

The Problem:

During resizing of the form, the performance is absolutely awful and in some cases the entire application crashes (depends on quality of machine). This is because the MapControl constantly refreshes in order to maintain the same extents of the map.

Question:

Is there a way to prevent the MapControl from refreshing to maintain its extents?

1 Answer 1

3

You'll want to attach an event handler to your form's resize begin event, suppress map control resize in there, then enable it in the form's resize end event. See IMapControl3.SuppressResizeDrawing method.

Sample code:

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

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

In the code above, MapViewer is the form containing the map control. Simply add event handlers to the form for ResizeBegin and ResizeEnd events and use the above functions for the event handlers. If you have any other map containers such as a layout control, make sure you suppress the resize drawing for them as well.

1
  • Aha! SuppressResizeDrawing, I should've known! :) thank you!
    – tbridge
    Commented Aug 31, 2011 at 16:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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