ArcEngine custom toolbar C#

1561
1
04-03-2014 11:29 AM
KevinYanuk
Occasional Contributor
Hello,

I am playing with the idea of an ArcEngine application with a custom toolbar I can add to the map control, but I am a bit stuck.

I have added a new item -> Base Toolbar, where I can add esri commands:

    [Guid("bf252637-ecde-48c3-9464-238bae6f800e")]
    [ClassInterface(ClassInterfaceType.None)]
    [ProgId("MyProject.MyCustomToolbar")]
    public sealed class MyToolbar: BaseToolbar
    {
         public MyToolbar()
         {
             this.AddItem("{380FB31E-6C24-4F5C-B1DF-47F33586B885}"); //undo command
             this.AddItem(new Guid("B0675372-0271-4680-9A2C-269B3F0C01E8")); //redo command
         }
    }



Is it possible to add buttons to a toolbar like this?  In Arcmap, I have done it through the XML config with classes that inherit from esri addin control classes:

<AddIn language="CLR">
    <ArcMap>
      <Commands>
        <Button class="ButtonClass"


Where the class:

public class ButtonClass : Esri.ArcGIS.Desktop.AddIns.Button
{
}



Has anyone done this with ArcEngine applications?
0 Kudos
1 Reply
NeilClemmons
Regular Contributor III
Unless something's changed, Engine ships with a toolbar control that you can drop onto a form.  In it's property pages you can pick what you want to go on the toolbar.  To add your own custom commands and tools you implement ICommand and/or ITool and register the class in the map control's component categories.  After that, you can pick them through the property pages just like a builtin command or tool.  When deploying the app, you'll need to register those custom commands and tools on the user's machine in order for them to be available.
0 Kudos