Udostępnij za pośrednictwem


CustomTaskPane.Visible Property (2007 System)

Gets or sets a value that specifies whether the custom task pane is visible.

Namespace:  Microsoft.Office.Tools
Assembly:  Microsoft.Office.Tools.Common.v9.0 (in Microsoft.Office.Tools.Common.v9.0.dll)

Syntax

'Declaration
Public Property Visible As Boolean
'Usage
Dim instance As CustomTaskPane 
Dim value As Boolean 

value = instance.Visible

instance.Visible = value
public bool Visible { get; set; }
public:
property bool Visible {
    bool get ();
    void set (bool value);
}
public function get Visible () : boolean 
public function set Visible (value : boolean)

Property Value

Type: System.Boolean
true if the custom task pane is visible; otherwise, false. The default is false.

Exceptions

Exception Condition
COMException

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

ObjectDisposedException

The Dispose method of the CustomTaskPane has already been called.

Remarks

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.

Examples

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

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

.NET Framework Security

See Also

Reference

CustomTaskPane Class

CustomTaskPane Members

Microsoft.Office.Tools Namespace