CustomTaskPane.DockPositionStateChange event (Office)
Occurs when the user changes the docking position of the active custom task pane.
Syntax
expression.DockPositionStateChange (CustomTaskPaneInst)
expression An expression that returns a CustomTaskPane object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
CustomTaskPaneInst | Required | Object | The active custom task pane. |
Example
The following example, written in C#, creates a custom task pane and adds a Microsoft ActiveX button control that was created in another project. A DockPositionStateChange event of type _CustomTaskPaneEvents_DockPositionStateChangeEventHandler is then defined. When the event is triggered, a message box is displayed telling the user that the docked task pane has been moved.
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.DockPositionStateChange += new _CustomTaskPaneEvents_DockPositionStateChangeEventHandler(CTP_DockPositionStateChange);
}
private void CTP_DockPositionStateChange(object sender, string dockpositionArgs)
{
Console.WriteLine("The custom task pane was moved");
}
Note
You can create custom task panes in any language that supports COM and allows you to create dynamic-linked library (DLL) files; for example, Microsoft Visual Basic 6.0, Visual Basic .NET, Visual C++, Visual C++ .NET, and Visual C#. However, Microsoft Visual Basic for Applications (VBA) does not support creating custom task panes.
See also
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for