How to: Add a Custom Task Pane to an Application
You can add a custom task pane to the applications listed above by using VSTO Add-in. For more information, see Custom Task Panes.
Applies to: The information in this topic applies to VSTO add-in projects for Outlook. For more information, see Features Available by Office Application and Project Type.
|
To add a custom task pane to an application
Open or create a VSTO Add-in project for one of the applications listed above. For more information, see How to: Create Office Projects in Visual Studio.
On the Project menu, click Add User Control.
In the Add New Item dialog box, change the name of the new user control to MyUserControl, and then click Add.
The user control opens in the designer.
Add one or more Windows Forms controls from the Toolbox to the user control.
Open the ThisAddIn.cs or ThisAddIn.vb code file.
Add the following code to the
ThisAddInclass. This code declares instances ofMyUserControland CustomTaskPane as members of theThisAddInclass.Add the following code to the
ThisAddIn_Startupevent handler. This code creates a new CustomTaskPane by adding theMyUserControlobject to theCustomTaskPanescollection. The code also displays the task pane.
Note
This code associates your custom task pane with the active window in the application. For some applications, you might want to modify this code to ensure that the task pane appears with other documents or items in the application. For more information, see Custom Task Panes.
Office UI Customization
Custom Task Panes
Walkthrough: Automating an Application from a Custom Task Pane