This project is read-only.

Add Icon and method

Dec 7, 2015 at 8:25 AM
Edited Dec 7, 2015 at 8:26 AM

As a newbie, it took me a while to put all together to add a new command to a toolbar, called from an icon. So here are the steps I found :

About the icon

1) You can create your icon, as long as it is accepted by VS (I used a 48x48 png icon) or use Syncfusion Metro that is free and offers thoudands of icons ans some tools to modify them.

2) Open your solution, goto project plugin/properties/resources tab/Add resource/select "Add existing file" select your icon file <icon name> in your <icon folder>

About the called method

3) Create Key constant in MenuKeys.cs
public const string <command name> = "<command name>"; Make sure that a key is unique for all plugins.
4) Create a list of MenuCommands for every toolbar button created in MenuGenerator in MenuCommand.cs
new MenuCommand("<command name>", MenuKeys<command name>., Resources.<icon name>) (file name without extension created in point 2)
5) Add buttons to menu in MenuGenerator.cs InitMenu
menu.SubItems.AddButton("<command name>", MenuKeys.<command name>, identity);
6) Add buttons to a toolbar in MenuGenerator.cs InitToolbar
bar.Items.AddButton(_commands[MenuKeys.<command name>]);
7) Add your command in MenuListener.cs Plugin_ItemClicked
Case MenuKeys.<command name>
<your <command name> method>

Marked as answer by pmeems on 12/7/2015 at 12:30 AM