Toolbar Controls
for Microsoft® Office
Add any .NET controls to Outlook toolbars
The Toolbar Controls for Office makes possible to add any visual .NET controls, including buttons, grids, labels, tree-views, check boxes as well as ActiveX controls onto standard Outlook toolbars (commandbars). Until now Outlook developers have been limited in choosing visual controls, since the Outlook Object Model (the same as the Office Object Model) allows only five types of controls: msoControlButton, msoControlEdit, msoControlDropDown, msoControlComboBox and msoControlPopup. Buttons, edits, combos, and dropdowns are just shadows of habitual .NET controls. Say, command bar buttons don't provide the MouseOver event. Also, Office developers have been always interested in msoControlActiveX, its name assumes that ActiveX controls can be used on Outlook commandbars. Unfortunately, this control is not properly implemented by Microsoft either.
Now all these limitations are overpassed. With Toolbar Controls for Microsoft Office you can use any .NET controls (Button, Label, Panel, CheckBox, ComboBox, ListView, ProgressBar, TreeView and visual ActiveX controls) side by side with built-in Office controls. It helps customize Outlook toolbar / commandbar and get enhanced custom controls on both built-in and custom commandbars.
How to customize Outlook toolbar with your own controls
The step-by-step example below shows how to customize Outlook 2003 commandbar with the Toolbar Controls for Microsoft Office in Visual Studio 2005. Now we are going to add a DateTimePicker control to the Explorer toolbar. In the same way you create custom Outlook controls for your toolbars in Visual Studio 2003 and Outlook 2000, 2002 (XP) and Outlook 2007. This sample doesn't contain a single line of code which illustrates how simple and easy-to-use the Toolbar Controls is. To reproduce the example below you can create a new add-in project based on Add-in Express and open its add-in module. Now, step-by-step.
1. Set toolbar properties
Create a new Outlook Explorer commandbar in the add-in module and set its properties such as Position and CommandBarName.

2. Add a control adapter
Toolbar Controls .NET for Microsoft Office adds to the Toolbox several special components that support .NET controls on command bars of the corresponding Office application. There is an Outlook-specific component called ADXOutlookControlAdapter. The Outlook control adapter (read more about Control adapters below) makes possible interacting with the Toolbar Controls .NET and Microsoft Outlook. So, you add the Outlook control adapter to the add-in module.

3. Add a .NET control to Outlook toolbar
Drop the .NET control that you want to place onto the Outlook commandbar on the add-in module. Then you can customize the control via its properties and handle its events. In the example we use DateTimePicker (see the picture below). As you understand, you can add any visual .NET and ActiveX controls in the same way. Please note, for your ActiveX controls to work correctly, they should be properly implemented.

4. Bind your control to Outlook toolbar
Add-in Express groups all command bar controls into the Controls collection of the corresponding commandbar component (ADXOlExplorerCommandBar in this case). This collection may include a special control that is necessary for placing your .NET control onto the commandbar. It is ADXCommandBarAdvancedControl, so add an ADXCommandBarAdvancedControl to your Outlook toolbar / command bar.

Then, you bind your .NET control to your Outlook CommandBar. So, select the added ADXCommandBarAdvancedControl in the Properties window and select your .NET control in the ADXCommandBarAdvancedControl.

5. Have your .NET control on Outlook CommandBar
Finally, you register your add-in project, run Outlook and find your toolbar customized with your .NET control.

In the same way you can add any other .NET controls both standard (buttons, labels, etc.) and custom. You may also want to have a look at another sample project showing how to add a custom control (CheckBox) to Outlook toolbar.
Control Adapters
The Toolbar Controls adds a new tab, "Toolbar Controls for Microsoft Office", to the Toolbox and places several components on the tab. The Toolbar Controls supports each Office application with special components that we call Control Adapters. Only control adapters know how to add your controls to applications specific command bars.
All control adapters can be contained by the add-in module only. For example, you should add an ADXExcelControlAdapter to the add-in module if you wand to use non-Office controls in your Excel add-in commandbar. To use non-Office controls on several Office applications you should add several control adapters. So, if you need to use your controls in your add-in that supports Outlook, Excel and Word, you should add three control adapters: ADXExcelControlAdapter, ADXWordControlAdapter and ADXOutlookControlAdapter to the add-in module.
The Outlook control adapter is optimized for placing .NET controls onto Outlook commandbar only. It makes possible using .NET controls (button, textbox, label, etc.) on two main Outlook windows - the Outlook Explorer and Inspector windows. With the Outlook control adapter you can customize command bars on all types of Outlook Inspectors including contact, e-mail, task, appointment windows and customize commandbars for all Outlook views.
|