
Managing the User Interface of the Task Pane
After you create the task pane, you can use properties and events of the CustomTaskPane object to control the user interface of the task pane and to respond when the user changes the task pane.
Making the Custom Task Pane Visible
By default, the task pane is not visible. To make the task pane visible, you must set the Visible property to true.
Users can close a task pane at any time by clicking the Close button (X) in the corner of the task pane. However, there is no default way for users to open the custom task pane again. If a user closes a custom task pane, that user cannot view the custom task pane again unless you provide a way to display it.
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. If you create a custom task pane in a Microsoft Office application that supports customizing the Ribbon, you can add a control group to the Ribbon with a button that displays or hides your custom task pane. For a walkthrough that demonstrates how to do this, see Walkthrough: Synchronizing a Custom Task Pane with a Ribbon Button.
If you create a custom task pane in a Microsoft Office application that does not support customizing the Ribbon, you can add a CommandBarButton that displays or hides your custom task pane.
Modifying the Appearance of the Task Pane
You can control the size and location of a custom task pane by using properties of the CustomTaskPane object. You can make many other changes to the appearance of a custom task pane by using properties of the UserControl object that is contained in the custom task pane. For example, you can specify a background image for a custom task pane by using the BackgroundImage property of the user control.
The following table lists the changes you can make to a custom task pane by using CustomTaskPane properties.
Programming Custom Task Pane Events
You might want your add-in to respond when the user modifies the custom task pane. For example, if the user changes the orientation of the pane from vertical to horizontal, you might want to reposition the controls.
The following table lists the events that you can handle to respond to changes that the user makes to the custom task pane.
Task
|
Event
|
|---|
To respond when the user changes the location of the task pane.
| DockPositionChanged |
To respond when the user hides the task pane or makes it visible.
| VisibleChanged |