How to add custom button, checkbox, combo box, image, tree-view.
Customize Outlook toolbar in .NET with your controls.
Toolbar Controls Add-in Express Home > Toolbar Controls for Microsoft Office > Online Guide > Adding controls to Outlook toolbar Create advanced command bar controls for OutlookThis sample demonstrates features described in Custom Toolbar Controls. Just follow the first three steps described in Developing Microsoft Outlook add-ins sample. Add an ADXOlInspectorCommandBar to the add-in module (see Step 7. Adding a new Inspector toolbar of the same sample). Now set adxMsoBarBottom to the Position property of the added command bar. This sample is written in VB.NET, but you can develop your Outlook controls in C# and C++ 1. Add an Outlook Control AdapterCustom Toolbar Controls supports Office applications through special components that we call control adapters. You can find them on the Toolbar Controls for Microsoft Office tab in the Toolbox. The first step in using non-Office controls in your add-in is adding the corresponding control adapter to your add-in module. In this case, we use an ADXOutlookControlAdapter. 2. Add your custom control to Outlook toolbarThe add-in module can contain any components including controls. Therefore, you can add a check box (BossCheckBox) directly to your add-in module and customize the checkbox in any way you like. Then, you can customize the checkbox. For example, like this: 3. Handle your control eventsTo BCC a message to your boss you need to handle the checkbox. We usually use the following code to BCC messages to our boss. Please note we do not touch Outlook programming here. VB.NET:
4. Bind your control to Outlook commandbarTo bind BossCheckBox to the Outlook toolbar, you add an advanced command bar control (ADXCommandBarAdvancedControl1) to the Controls collection of your Outlook Inspector toolbar and select BossCheckBox in the Control property of the ADXCommandBarAdvancedControl1. That's all. You have done all necessary steps to place your checkbox on your Outlook commandbar. Below we give the complete code of the InitializeComponent method of our add-in module: VB.NET
5. Register and run your add-ininally, you can rebuild the add-in project, run Outlook, and find your check box: That's it! You may also want to have a look at another sample project showing how to add a custom control (DateTimePicker) to Outlook toolbar. |