Two MapControls

258
5
05-21-2014 10:44 PM
MickeyO_Neil
New Contributor III
Hi,

I have made an extension for ArcMap. In this extention you can open a window(non-modal-window) with a MapControl in it.
In this MapContol the Scrollbars are always deactivated and it is not possible to activate them over the GUI.
So, if the window with my MapControl is open and I change the view in ArcMap, from data view to layout view, the Scrollbars in ArcMap disappear.
During Debug-Mode I found out, that ArcMap uses the MapControl Settings of my window. I can only change them for both.
How do i set the Scrollbars for arcmap visible and for my MapContol invisible?

Thanks for your help.
Cheers
Mickey
Reply
0 Kudos
5 Replies
NeilClemmons
Regular Contributor III
Without seeing your code I can only guess but it sounds like you've set the map for your map control to the document's map.  Something like this:  mapControl.Map = document.FocusMap.  If so, then the behavior you are seeing is what you should expect to happen.  Both ArcMap and your map control are using the same map, so if you change it in any way you should see those changes in both.  To prevent this, you need to set your map control to use a copy of the map from the document.  You can do this using IObjectCopy.
Reply
0 Kudos
MickeyO_Neil
New Contributor III
Thanks, I will have a closer look to my Code.
But the MapControls are showing two different Maps from two different MXDs :confused:.
Reply
0 Kudos
MickeyO_Neil
New Contributor III
The Map Control and the Document have two different maps. I tried the following code:


m_PlanActiveView = m_pMap 'set the Map of the MapControl
m_PlanActiveView.ShowScrollBars = False 'MapControl ScrollBars are not visible
If ClassGlobal.ActiveView.FocusMap IsNot m_pMap Then 'ClassGlobal.ActiveView is the ActiveView of ArcMap
   ClassGlobal.ActiveView.ShowScrollBars = True 'If this line is executed m_PlanActiveView.ShowScrollBars changes to True(!!!)
   ClassGlobal.ActiveView.ShowSelection = False 'Test if this problem affects other properties of the MapControl
   m_PlanActiveView.ShowSelection = True '.. no, ClassGlobal.ActiveView.ShowSelection stays False while m_PlanActiveView.ShowSelection is True
End If


Maybe it's a bug in arcobjects?
Reply
0 Kudos
MickeyO_Neil
New Contributor III
I just made a MapControl and set the Property "ShowScrollbars" to False:

[ATTACH=CONFIG]34131[/ATTACH]

No personal Code, just Windows Form-Designer.
If I open the Window (non-modal) in ArcMap and switch between Data-View and Layout-View the Scrallbars of ArcMap disappear.

Why:confused:
Reply
0 Kudos
NeilClemmons
Regular Contributor III
It appears to be a bug.  We have an application that uses the map control to display a preview.  Even though the map shown in the map control is the map from the document, we create a deep copy of the map object before assigning it to the map control.  I usually keep my scroll bars in ArcMap turned off.  If I turn them on, switch to layout view then back to data view, the scroll bars remain visible.  If I do the same thing with our dialog open, the scroll bars disappear when I return to data view.  The map control has its scroll bars turned off.  I'm not really sure why ArcMap would be picking up that property setting but it apparently does.
Reply
0 Kudos