How to zoom in/out selected elements of MapControl ?

629
3
08-18-2013 07:55 PM
TaiBui
by
Occasional Contributor II
Hi everyone,

I have a mapcontrol that includes many elements: text, line.
I used this code to add elements into mapcontrol:  pGraphicsContainer.AddElement(pElement, 0);

I can use zoom button to zoom in/out the mapcontrol, but how can I zoom in/out only seleted elements ?

Is there any buttons for this purpose in Arcgis ?

Thanks and regards,

Tai
0 Kudos
3 Replies
DuncanHornby
MVP Notable Contributor
Are you wanting to call an existing desktop button? If so, there is the Zoom to selected elements which is found under the Edit menu. You could call this? Have a look at this page and look for esriArcMapUI.ZoomToSelectedGraphicsCommand.
0 Kudos
TaiBui
by
Occasional Contributor II
Thanks Hornby,

But this require a IMxDocument object to get commandBars, but I only have the IMap (FocusMap of my pagelayout control):

myPageLayout.ActiveView.FocusMap

How can I do that ?

Regards,

Tai
0 Kudos
DuncanHornby
MVP Notable Contributor
Tai,

Looks like you are building an Engine based application. I have personally not done that, but look here, have a look at the onCreate method.

Duncan
0 Kudos