Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer
    
Aha! SuppressResizeDrawing, I should've known! :) thank you! –  tbridge Aug 31 '11 at 16:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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