CustomTaskPaneCollection Interface

Definition

Represents a collection of custom task panes in a Microsoft Office application.

public interface class CustomTaskPaneCollection : IDisposable, System::Collections::Generic::IEnumerable<Microsoft::Office::Tools::CustomTaskPane ^>
[System.Runtime.InteropServices.Guid("c3a84bf1-e95b-4d23-952d-59e35673958e")]
public interface CustomTaskPaneCollection : IDisposable, System.Collections.Generic.IEnumerable<Microsoft.Office.Tools.CustomTaskPane>
[<System.Runtime.InteropServices.Guid("c3a84bf1-e95b-4d23-952d-59e35673958e")>]
type CustomTaskPaneCollection = interface
    interface seq<CustomTaskPane>
    interface IEnumerable
    interface IDisposable
Public Interface CustomTaskPaneCollection
Implements IDisposable, IEnumerable(Of CustomTaskPane)
Attributes
Implements

Examples

The following code example demonstrates how to create a custom task pane by using the Add(UserControl, String) method. The example also uses properties of the CustomTaskPane object to modify the default appearance of the custom task pane. This code example is part of a larger example provided for CustomTaskPane.

private MyUserControl myUserControl1;
private Microsoft.Office.Tools.CustomTaskPane myCustomTaskPane;

private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
    myUserControl1 = new MyUserControl();
    myCustomTaskPane = this.CustomTaskPanes.Add(myUserControl1,
        "New Task Pane");

    myCustomTaskPane.DockPosition =
        Office.MsoCTPDockPosition.msoCTPDockPositionFloating;
    myCustomTaskPane.Height = 500;
    myCustomTaskPane.Width = 500;

    myCustomTaskPane.DockPosition =
        Office.MsoCTPDockPosition.msoCTPDockPositionRight;
    myCustomTaskPane.Width = 300;

    myCustomTaskPane.Visible = true;
    myCustomTaskPane.DockPositionChanged +=
        new EventHandler(myCustomTaskPane_DockPositionChanged);
}
Private myUserControl1 As MyUserControl
Private WithEvents myCustomTaskPane As Microsoft.Office.Tools.CustomTaskPane

Private Sub ThisAddIn_Startup(ByVal sender As Object, ByVal e As System.EventArgs) _
    Handles Me.Startup

    myUserControl1 = New MyUserControl()
    myCustomTaskPane = Me.CustomTaskPanes.Add(myUserControl1, "New Task Pane")

    With myCustomTaskPane
        .DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionFloating
        .Height = 500
        .Width = 500
        .DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionRight
        .Width = 300
        .Visible = True
    End With
End Sub

Remarks

Use the CustomTaskPaneCollection object in an application-level add-in to add a custom task pane to an application, remove a custom task pane, or access an existing custom task pane. To access the CustomTaskPaneCollection object, use the CustomTaskPanes field of the ThisAddIn class in your add-in project. For more information, see Programming VSTO Add-Ins.

Task panes are user interface panels that are typically docked to one side of an application window. For more information about how to create custom task panes, see Custom Task Panes.

Note

This interface is implemented by the Visual Studio Tools for Office runtime. It is not intended to be implemented in your code. For more information, see Visual Studio Tools for Office Runtime Overview.

Usage

This documentation describes the version of this type that is used in Office projects that target the .NET Framework 4 or later. In projects that target the .NET Framework 3.5, this type might have different members and the code examples provided for this type might not work. For documentation about this type in projects that target the .NET Framework 3.5, see the following reference section in the Visual Studio 2008 documentation: http://go.microsoft.com/fwlink/?LinkId=160658.

Properties

Count

Gets the number of CustomTaskPane objects in the current CustomTaskPaneCollection.

Item[Int32]

Gets the CustomTaskPane at the specified index.

Methods

Add(UserControl, String)

Creates a new CustomTaskPane and adds it to the current CustomTaskPaneCollection. The custom task pane is based on the specified UserControl and has the specified title.

Add(UserControl, String, Object)

Creates a new CustomTaskPane and adds it to the current CustomTaskPaneCollection. The custom task pane is based on the specified UserControl, has the specified title, and is associated with the specified application window.

BeginInit()
EndInit()
Remove(CustomTaskPane)

Removes the specified CustomTaskPane from the CustomTaskPaneCollection.

RemoveAt(Int32)

Removes the CustomTaskPane at the specified index of the CustomTaskPaneCollection.

Applies to