0

I have a .NET application dependent on ArcGIS 9.3.1 which I am upgrading to ArcGIS 10.2.

I have an AxMapControl sat in a panel in a Splitter on a tab. There is a legend which can be made to appear/disappear using the Show/Hide Map Legend button.

When the application is built against the ArcGIS 9.3.1 DLLs, the map expands to fill the available space if you hide the legend using the button. Nice!

However, when building against the ArcGIS 10.2 DLLs, the map does not expand if the legend is hidden. The map remains the same size and the legend vanishes to reveal a useless grey panel next to the map.

This seems to be a problem internal to the control. Does anyone have a workaround (other than reverting to the 9.3.1 DLLS)?

2 Answers 2

1

On A Form with a split container I added a Map Control docked in one panel and a toccontrol docked the other. I set the mapcontrol to be the buddycontrol of the toccontrol. and added a mouse down event to that has the following code. This works perfectly in ArcGIS 10.2.2, the map expands and contracts and changes the extent as expected. Basically what your button would do.

This functionality works fine out of the box.

    private void axMapControl1_OnMouseDown(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent e)
    {
        if (splitContainer1.Panel1Collapsed == true)
        {
            splitContainer1.Panel1Collapsed = false;

        }
        else
            splitContainer1.Panel1Collapsed = true;
    }

If you are using a custom legend, not the toccontrol, the map will still resize as expected. The Resize and re-draw are handled by the mapcontrol, and seem to work fine for me. Based on your other post I would look at your event handling and comment all of the code in them out to see if the controls resize and re-draw properly. From there, I would then add pieces back in to see at what point the re-drawing begins to fail.

0
0

As part of the port from 9.3 to 10.2, I needed to solve a related problem here:

Workaround for AxMapControl painting issue (only problematic at certain screen resolutions)?

One of the fixes I tried for that problem was anchoring the AxMapControl at all four points: top, bottom, left, and right - to try to force the control to repaint the map across the whole space.

This had the effect of neutralizing the automatic expansion of the control that would normally happen inside the Splitter (NB the code uses the older Splitter control rather than the SplitContainer). I removed the anchoring (which, in the end, I didn't need anyway) and that solved the problem.

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.