OnMouseUp Event in ArcObjects (without usign add-in framework)

2072
1
11-20-2014 05:31 PM
JosephSaltenberger
New Contributor III

I have been successful in implementing the onMouseUp event using a tool from the add-in framework. (See Below)

protected override void OnMouseUp(ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs arg)

{

}

I want my button that registers the onMouseUp event to be in a Windows form, so I'm trying to accomplish the same thing, but not using the add-in framework. From what I've seen, it looks like I need to use the iTool, iCommand interfaces, but I haven't gotten much farther than that.

Any recommendations/code samples on how to accomplish this task would be appreciated. Thanks.

0 Kudos
1 Reply
JosephSaltenberger
New Contributor III

I ended up creating a button in the form, then referencing the add-in tool. In ArcGIS, I simply don't add the add-in tool to the toolbar (instead use the button in the form) and it is still accessible by the application. Here is the click event code for the button that accesses the add-in tool:

        UID uid = new UIDClass();
        uid.Value = ThisAddIn.IDs.SelectByRZ;
        ICommandItem _selectionTool = ArcMap.Application.Document.CommandBars.Find(uid, false, false);

        if (_selectionTool == null)
        {
            MessageBox.Show("Selection tool is not found.");
        }

        if (_selectionTool != null)
        {
            ArcMap.Application.CurrentTool = _selectionTool;
        }
0 Kudos