0

In ArcMap, users could double-click on elements like north arrow and then change its properties in a pop-up dialog.

I was wondering how to accomplish this using ArcObjects?

closed as off-topic by PolyGeo Jun 4 '18 at 8:01

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "When seeking help to debug/write/improve code always provide the desired behavior, a specific problem/error and the shortest code (as formatted text, not pictures) needed to reproduce it in the question body. Providing a clear problem statement and a code attempt helps others to help you." – PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.

1

If you are wanting to see the same dialog that opens when you insert a new North Arrow the easiest way is to call the button that you would have clicked on in ArcGIS. The following VBA code shows how to do this:

Public Sub OpenInsetNorthArrowDialog()
    Dim pCommandBars As ICommandBars
    Set pCommandBars = Application.Document.commandBars
    Dim pUid As uid
    Set pUid = New uid
    pUid.Value = "{99D21D7A-B475-11D1-8753-0000F8751720}"
    Dim pCommandItem As ICommandItem
    Set pCommandItem = commandBars.Find(pUid, False, False)
    If Not pCommandItem Is Nothing Then
        pCommandItem.Execute
    End If
End Sub

How you open the properties dialog of an existing North Arrow on a PageLayout I've never done but I think its all to do with ComPropertySheets, hopefully someone can add to this answer?

1

Elements like north arrows and scale bars implement IMapSurround, so first you'd want to loop through the map surrounds in the map and find the type of surround you're looking for, in this case the north arrow:

Dim pMap As IMap = My.ArcMap.Document.FocusMap
For i = 0 To pMap.MapSurroundCount - 1
    Dim pMapSurround As IMapSurround = pMap.MapSurround(i)
    If TypeOf pMapSurround Is INorthArrow Then
        Dim pNorthArrow As INorthArrow = pMapSurround
        ....do stuff with north arrow properties...
    EndIf
Next

Map Surround: http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/index.html#//001200000m47000000

North Arrow: http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/#/INorthArrow_Interface/001200000n26000000/

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