This documentation is archived and is not being maintained.

CustomTaskPane.DockPosition Property

Gets or sets a value that specifies where the custom task pane is located relative to the application window.

Namespace: Microsoft.Office.Tools
Assembly: Microsoft.Office.Tools.Common2007 (in microsoft.office.tools.common2007.dll)

public MsoCTPDockPosition DockPosition { get; set; }

Property Value

One of the Microsoft.Office.Core.MsoCTPDockPosition values. The default is Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionRight.

Exception typeCondition

ObjectDisposedException

The Dispose method of the CustomTaskPane has already been called.

ComException

The value of the DockPositionRestrict property is Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionRestrictNoChange when you try to change the value of the DockPosition property.

The following table lists the values of the Microsoft.Office.Core.MsoCTPDockPosition enumeration.

Value

Description

msoCTPDockPositionLeft

Docks the custom task pane to the left side of the window.

msoCTPDockPositionTop

Docks the custom task pane to the top of the window.

msoCTPDockPositionRight

Docks the custom task pane to the right side of the window.

msoCTPDockPositionBottom

Docks the custom task pane to the bottom of the window.

msoCTPDockPositionFloating

Displays the custom task pane in front of the window. The user can drag the task pane to any location in the window.

The following code example creates a custom task pane and displays it in front of the active application window. This code example is part of a larger example provided for the CustomTaskPane class.

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.DockPositionRestrict =
        Office.MsoCTPDockPositionRestrict.msoCTPDockPositionRestrictNoHorizontal;
    myCustomTaskPane.Visible = true;

    myCustomTaskPane.VisibleChanged += 
        new EventHandler(myCustomTaskPane_VisibleChanged);
    myCustomTaskPane.DockPositionChanged += 
        new EventHandler(myCustomTaskPane_DockPositionChanged);
}

Show: