1. Create a new COM add-in project with Add-in Express
Wizard
In VS IDE, select the "New | Project:" item on the main
menu, and run the "ADX COM Add-in" wizard in the "Other
Projects | Extensibility Projects" item of the "New Project"
dialog box.
Seelct a project type and click Finish.
The wizard generates a new add-in solution including the
main project with an add-in's RAD module, the setup project
and the shim (optional), and opens it.
2. Customize your add-in
In the Solution Explorer window, select the add-in
module, activate the Properties window, name your add-in via
the AddInName property (this name will appear in the COM
Add-ins dialog box of the host applications), and select the
host applications you need in the SupportedApps property.
3. Add a new command bar
To add a new command bar click one of the Add Command Bar
links on the Properties window.
In the Properties window, name the added command bar via
the CommandBarName property and select its position via the
Position property.
4. Add a new button to the command bar
In the Properties windows, select the Controls property,
run its editor, click the Add button.
Then name the added button via the Caption property and
close the collection editor.
To handle the button click select the added button and
add the OnClick event handler in the Properties window .
private void
adxCommandBarButton1_OnClick(object Sender)
{
MessageBox.Show("I've done it!");
}
5. Register and run the add-in
Close all the applications that you have selected as
add-in's host applications, save the project, and compile
it. Run one of the selected host applications, find your
toolbar and click the button.
|