I'm writing a add-in for ArcMap 10.5 in VB.NET. I've chosen the item "Button". So when I click on the button I need the mouse pointer, when in MapView, to turn into an arrow (like the Select Feature arrow). Right now it only turns into the Pan (hand).
This is how my current code looks like:
Public Class btnMatareIdentify
Inherits ESRI.ArcGIS.Desktop.AddIns.Button
Public Sub OnClick(ByVal cursorID As Object)
Dim app As IApplication
Dim appCursor As IMouseCursor = New MouseCursorClass
Dim pMxDoc As IMxDocument
Dim pActiveView As IActiveView
pMxDoc = My.Document
pActiveView = pMxDoc.ActiveView
If TypeOf pActiveView IsNot IPageLayout Then
appCursor.SetCursor(0)
myMethod()
Else
MsgBox("You need to be in MapMode")
End If
End Sub
End Class
1 Answer 1
Please see here for using the IMouseCursor method to display other cursors:
Be aware that the cursor will return to the default as soon as the calling procedure ends.
That being said I'm wondering what you are trying to achieve here? Usually a button just executes some action and then ends so you wouldn't change the cursor to anything but a wait cursor. Depending on what you want to do a Tool might be what you are looking for. It has a property for the cursor and when activated it displays that cursor.