Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2008
Visual Studio
Reference
 DockPosition Property (2007 System...
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
Visual Studio Tools for Office API Reference
CustomTaskPane..::.DockPosition Property (2007 System)

Updated: November 2007

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.Common.v9.0 (in Microsoft.Office.Tools.Common.v9.0.dll)

Visual Basic (Declaration)
Public Property DockPosition As MsoCTPDockPosition
Visual Basic (Usage)
Dim instance As CustomTaskPane
Dim value As MsoCTPDockPosition

value = instance.DockPosition

instance.DockPosition = value
C#
public MsoCTPDockPosition DockPosition { get; set; }

Property Value

Type: Microsoft.Office.Core..::.MsoCTPDockPosition

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

ExceptionCondition
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.

-or-

You try to set this property in the event handler for the DockPositionChanged or VisibleChanged event.

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 configures different default sizes for when the pane displays in front of the active application window, and when it is docked. This code example is part of a larger example provided for the CustomTaskPane class.

Visual Basic
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

C#
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);
}

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker