CustomTaskPaneCollection Interface

 

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

Namespace:   Microsoft.Office.Tools
Assembly:  Microsoft.Office.Tools.Common (in Microsoft.Office.Tools.Common.dll)

[GuidAttribute("c3a84bf1-e95b-4d23-952d-59e35673958e")]
public interface CustomTaskPaneCollection : IEnumerable<CustomTaskPane>, 
	IEnumerable, IDisposable

NameDescription
System_CAPS_pubpropertyCount

Gets the number of CustomTaskPane objects in the current CustomTaskPaneCollection.

System_CAPS_pubpropertyItem[Int32]

Gets the CustomTaskPane at the specified index.

NameDescription
System_CAPS_pubmethodAdd(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.

System_CAPS_pubmethodAdd(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.

System_CAPS_pubmethodBeginInit()

This API supports the product infrastructure and is not intended to be used directly from your code.

System_CAPS_pubmethodDispose()

(Inherited from IDisposable.)

System_CAPS_pubmethodEndInit()

This API supports the product infrastructure and is not intended to be used directly from your code.

System_CAPS_pubmethodGetEnumerator()

(Inherited from IEnumerable<T>.)

System_CAPS_pubmethodRemove(CustomTaskPane)

Removes the specified CustomTaskPane from the CustomTaskPaneCollection.

System_CAPS_pubmethodRemoveAt(Int32)

Removes the CustomTaskPane at the specified index of the CustomTaskPaneCollection.

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.

System_CAPS_noteNote

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.

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.

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);
}
Return to top
Show: