Export (0) Print
Expand All

CustomTaskPane.VisibleChanged Event

Occurs when the user displays or closes the custom task pane, or when code changes the value of the Visible property.

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

public event EventHandler VisibleChanged

Applications in the 2007 Microsoft Office system do not provide a default UI for users to display custom task panes. If you create a custom task pane in your add-in, you should also create a UI element, such as a button, that users can click to display or hide your custom task pane. For more information, see Custom Task Panes Overview.

The following code example demonstrates an event handler for the VisibleChanged event. This event handler docks the custom task pane to the right side of the window when the custom task pane is displayed. This code example is part of a larger example provided for the CustomTaskPane class.

private void myCustomTaskPane_VisibleChanged(object sender, EventArgs e)
{
    Microsoft.Office.Tools.CustomTaskPane taskPane =
        sender as Microsoft.Office.Tools.CustomTaskPane;

    if (taskPane != null)
    {
        if (taskPane.Visible)
        {
            taskPane.DockPosition = 
                Office.MsoCTPDockPosition.msoCTPDockPositionRight;
        }
    }
}

Show:
© 2014 Microsoft