How to change the ArcMap cursor from winForm app

3447
3
04-17-2015 11:27 AM
StevenMumby
New Contributor

Hi guys

I'm building an ArcMap add-in.  When the user selects my tool and then clicks a parcel, I extract details about the selected parcel, open a new winForm, and pass those into the newly opened winForm.  The GIS tech can then update parcel features in that winForm and save back to ArcMap.  In some cases, the tech may need to click additional parcels before finishing working in the winForm, so we have special buttons on the winForm to allow them to click more parcels in ArcMap.  Question is, how can I change the ArcMap cursor from my winForm when these special buttons are clicked?

Tks

0 Kudos
3 Replies
KenBuja
MVP Esteemed Contributor

You can change the IMousecursor with this code

Dim pMouseCursor As New ESRI.ArcGIS.Framework.MouseCursor
pMouseCursor.SetCursor(2)

These are the pre-installed cursors. The documentation show how to add custom cursors

0 Kudos
StevenMumby
New Contributor

Hey Ken

The trick is how to change the cursor on the ArcMap map FROM the opened winForm?  How do I get a reference from the winForm back to ArcMap?

Tks

0 Kudos
KenBuja
MVP Esteemed Contributor

This is the way I've done this from a Windows Form. For example, I have a DrawTool form in an add-in. When the user clicks on one of the buttons, the cursor will change on ArcMap.

Private Sub Draw_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPoint.Click, btnLocation.Click, btnPolygon.Click, btnFreehand.Click, btnRectangle.Click

   Select Case sender.name
       Case "btnPoint"
            Dim pMouseCursor As New ESRI.ArcGIS.Framework.MouseCursor
            pMouseCursor.SetCursor(2)
       // more cases
   End Select

End Sub
0 Kudos