Custom Task Pane Object Model Reference (Visual Studio Tools for Office)
CustomTaskPane.DockPositionChanged Event

Occurs when the user changes the dock position of the custom task pane, or when code changes the value of the DockPosition property.

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

Syntax

Visual Basic (Declaration)
Public Event DockPositionChanged As EventHandler
Visual Basic (Usage)
Dim instance As CustomTaskPane
Dim handler As EventHandler

AddHandler instance.DockPositionChanged, handler
C#
public event EventHandler DockPositionChanged
Example

The following code example demonstrates an event handler for the DockPositionChanged event. This event handler sets the height and width of the custom task when you drag the custom task pane from a docked position to a floating position. This code example is part of a larger example provided for the CustomTaskPane class.

Visual Basic
Private Sub myCustomTaskPane_DockPositionChanged(ByVal sender As Object, _
    ByVal e As EventArgs) Handles myCustomTaskPane.DockPositionChanged

    Dim taskPane As Microsoft.Office.Tools.CustomTaskPane = _
        TryCast(sender, Microsoft.Office.Tools.CustomTaskPane)

    If taskPane IsNot Nothing Then
        If taskPane.DockPosition = _
                Office.MsoCTPDockPosition.msoCTPDockPositionFloating Then
            taskPane.Height = 500
            taskPane.Width = 300
        End If
    End If
End Sub
C#
private void myCustomTaskPane_DockPositionChanged(object sender, EventArgs e)
{
    Microsoft.Office.Tools.CustomTaskPane taskPane =
        sender as Microsoft.Office.Tools.CustomTaskPane;

    if (taskPane != null)
    {
        if (taskPane.DockPosition ==
            Office.MsoCTPDockPosition.msoCTPDockPositionFloating)
        {
            taskPane.Height = 500;
            taskPane.Width = 500;
        }
    }
}
See Also

Page view tracker