Export (0) Print
Expand All

How to: Add a Custom Task Pane to an Application

Note Required applications

The features in this topic are available only if you have the required applications installed.

For more information, see Features Available by Product Combination.

  • One of these development environments:

    VSTO 2005

    -or-

    Visual Studio Team System

    -or-

    Visual Studio 2005 Professional Edition

  • VSTO 2005 SE installed in the development environment

  • 2007 Microsoft Office system

You can add a custom task pane to some applications in the 2007 Microsoft Office system by using an application-level add-in. For more information, see Custom Task Panes Overview.

NoteNote

The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, select Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.

Adding a Custom Task Pane to an Application

To add a custom task pane to an application

  1. Open or create an application-level project for an application in the 2007 Microsoft Office system. For more information, see How to: Create Visual Studio Tools for Office Projects.

    NoteNote

    Microsoft Office Visio 2007 does not support custom task panes. For more information, see Custom Task Panes Overview.

  2. On the Project menu, click Add User Control.

  3. In the Add New Item dialog box, change the name of the new user control to MyUserControl, and click Add.

    The user control opens in the designer.

  4. Drag one or more Windows Forms controls from the Toolbox to the user control.

  5. Open the ThisAddIn.cs or ThisAddIn.vb code file.

  6. Add the following code to the ThisAddIn class. This code declares an instance of MyUserControl as a member of ThisAddIn.

    private MyUserControl myUserControl1;
    
    
  7. Add the following code to the ThisAddIn_Startup event handler. This code adds the MyUserControl object to the CustomTaskPanes collection and displays the custom task pane.

    myUserControl1 = new MyUserControl();
    Microsoft.Office.Tools.CustomTaskPane myCustomTaskPane =
        this.CustomTaskPanes.Add(myUserControl1, "My Task Pane");
    myCustomTaskPane.Visible = true;
    
    

See Also

Community Additions

ADD
Show:
© 2014 Microsoft