CustomTaskPane.VisibleStateChange Event (Office)
Occurs when the user changes the visibility of the custom task pane.
Syntax
expression .VisibleStateChange(CustomTaskPaneInst, )
expression An expression that returns a CustomTaskPane object.
Parameters
Name |
Required/Optional |
Data Type |
Description |
---|---|---|---|
CustomTaskPaneInst |
Required |
CustomTaskPane |
The active task pane. |
Example
The following example, written in C#, creates a custom task pane and adds an ActiveX button control created in another project. A VisibleStateChange event of type _CustomTaskPaneEvents_VisibleStateChangeEventHandler is defined in the procedure. When the event is triggered, the event handler displays a message box depending on whether the task pane is currently visible or hidden.
object missing = Type.Missing;
public CustomTaskPane CTP = null;
public void CTPFactoryAvailable(ICTPFactory CTPFactoryInst)
{
CTP = CTPFactoryInst.CreateCTP("SampleActiveX.myControl", "Task Pane Example", missing);
sampleAX = (myControl)CTP.ContentControl;
sampleAX.InsertTextClicked += new InsertTextEventHandler(sampleAX_InsertTextClicked);
CTP.Visible = true;
CTP.VisibleStateChange += new _CustomTaskPaneEvents_VisibleStateChangeEventHandler(CTP_VisibleStateChange);
}
private void CTP_VisibleStateChange(object sender, string visiblestateArgs)
{
if (CTP.Visible)
{
Console.WriteLine("The custom task pane is now visible");
}
else
{
Console.WriteLine("The custom task pane has been hidden");
}
}
Note
Custom task panes can be created in any language that supports COM and allows you to create dynamic-linked library (DLL) files. For example, Microsoft Visual Basic® 6.0, Microsoft Visual Basic .NET, Microsoft Visual C++®, Microsoft Visual C++ .NET, and Microsoft Visual C#®. However, Microsoft Visual Basic for Applications (VBA) does not support creating custom task panes.