When we add a measure tool to the AxToolbarControl through the properties dialog, we can change to measure lenght and area in the dialog that pops up. But when we add a ControlsMapMeasureTool through code like this:
Dim control As AxMapControl = axMapControl1 Dim tool As New ControlsMapMeasureTool() tool.OnCreate(control.[Object]) control.CurrentTool = DirectCast(tool, ITool)
We followed the instructions in the documentations How to create a command or tool to work with the controls The dialog pops up but when we choose "Measure An Area" a new Measure dialog pops up and we can still only measure lenght. What are we doing wrong?
Steps to reproduce:
- Create a new MapControlApplication in VS
- Create a new MenuItem in the Menu "Test"
- Create a new OnClick event handler TestToolStripMenuItem_Click
- Paste the code above into the event handler
- Run the application
- Load a map that has a spatialreference that is a projected coord system (not a geographic coord system).
- choose the Test menu item
- Change to "Measure An Area" in the dialog
- Drag the dialog to the side.
- Two dialogs are active but only lenght can be measured.