ActionsPane Class (2007 System) Home
This page is specific to:.NET Framework Version:2.03.54.0
Visual Studio Tools for Office API Reference
ActionsPane Class (2007 System)

The class that provides implementation for customizing the Document Actions task pane in document-level customizations for Microsoft Office Word and Microsoft Office Excel.

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

'Usage

Dim instance As ActionsPane

'Declaration

<PermissionSetAttribute(SecurityAction.Demand, Name := "FullTrust")> _
Public NotInheritable Class ActionsPane _
    Inherits RemoteComponent _
    Implements ISupportInitializeControl, ISupportInitialize
Remarks

Use the ActionsPane class to customize the user interface of the Document Actions task pane in a document-level project. To get an instance of this class, use the ActionsPane object returned by the ActionsPane field of the ThisDocument class (for Word) and ThisWorkbook class (for Excel) in a document-level project. Do not create an instance of this class in your code. For more information, see Actions Pane Overview.

The ActionsPane class is designed to have similar functionality to the Windows Forms UserControl class. Although the ActionsPane class does not derive from UserControl, it does have most of the same properties, methods, and events as the UserControl class.

The ActionsPane class has the following members that represent actions pane-specific functionality:

  • Clear method. Use this method to detach the actions pane from the document.

  • AutoRecover property. Use this property to prevent or allow end users to detach the actions pane from the document.

  • Orientation property. Use this property to determine whether the actions pane is docked to the top or bottom of the document, or to the left or right of the document.

  • StackOrder property. Use this property to specify the direction that controls are stacked on the actions pane.

  • OrientationChanged event. Use this property to determine when the actions pane is docked to a different location.

Examples

The following code example demonstrates how to create a simple actions pane that automatically adjusts the alignment of its contents. When the user changes the orientation of the actions pane by moving the actions pane to a different part of the application window, or the user clicks on a Button control in the actions pane, the Orientation property is used to determine the new value of the StackOrder property. To run this code, call the InitActionsPane method from the ThisWorkbook_Startup event handler of a document-level project for Excel.

Private Sub InitActionsPane()
    With Globals.ThisWorkbook.ActionsPane
        .Clear()
        .Visible = True
        .AutoRecover = True
    End With

    AddHandler Globals.ThisWorkbook.ActionsPane.OrientationChanged, _
        AddressOf ActionsPane_OrientationChanged
    ResetStackOrder()

    ' Create the button that will update the stack order.
    Dim button1 As New Button()
    button1.Text = "Change stack order"
    AddHandler button1.Click, AddressOf button1_Click

    ' Create two more buttons that do nothing.
    Dim button2 As New Button()
    button2.Text = "Button 2"
    Dim button3 As New Button()
    button3.Text = "Button 3"

    Globals.ThisWorkbook.ActionsPane.Controls.AddRange(New Control() _
        {button1, button2, button3})
End Sub

' Switch the stack order according to the current orientation.
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)

    If Globals.ThisWorkbook.ActionsPane.Orientation = _
        Orientation.Horizontal Then

        If Globals.ThisWorkbook.ActionsPane.StackOrder = _
            Microsoft.Office.Tools.StackStyle.FromLeft Then
            Globals.ThisWorkbook.ActionsPane.StackOrder = _
                Microsoft.Office.Tools.StackStyle.FromRight
        Else
            Globals.ThisWorkbook.ActionsPane.StackOrder = _
                Microsoft.Office.Tools.StackStyle.FromLeft
        End If
    Else
        If Globals.ThisWorkbook.ActionsPane.StackOrder = _
            Microsoft.Office.Tools.StackStyle.FromTop Then
            Globals.ThisWorkbook.ActionsPane.StackOrder = _
                Microsoft.Office.Tools.StackStyle.FromBottom
        Else
            Globals.ThisWorkbook.ActionsPane.StackOrder = _
                Microsoft.Office.Tools.StackStyle.FromTop
        End If
    End If
End Sub

Private Sub ActionsPane_OrientationChanged(ByVal sender As Object, _
    ByVal e As EventArgs)
    ResetStackOrder()
End Sub

' Readjust the stack order so that it matches the current orientation.
Sub ResetStackOrder()
    If Globals.ThisWorkbook.ActionsPane.Orientation = _
        Orientation.Horizontal Then

        If (Globals.ThisWorkbook.ActionsPane.StackOrder = _
        Microsoft.Office.Tools.StackStyle.FromTop Or _
        Globals.ThisWorkbook.ActionsPane.StackOrder = _
        Microsoft.Office.Tools.StackStyle.FromBottom) Then
            Globals.ThisWorkbook.ActionsPane.StackOrder = _
                Microsoft.Office.Tools.StackStyle.FromLeft
        End If
    End If

    If Globals.ThisWorkbook.ActionsPane.Orientation = _
        Orientation.Vertical Then

        If (Globals.ThisWorkbook.ActionsPane.StackOrder = _
        Microsoft.Office.Tools.StackStyle.FromLeft Or _
        Globals.ThisWorkbook.ActionsPane.StackOrder = _
        Microsoft.Office.Tools.StackStyle.FromRight) Then
            Globals.ThisWorkbook.ActionsPane.StackOrder = _
                Microsoft.Office.Tools.StackStyle.FromTop
        End If
    End If
End Sub


Inheritance Hierarchy

System..::.Object
  Microsoft.VisualStudio.Tools.Office..::.RemoteComponent
    Microsoft.Office.Tools..::.ActionsPane
Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also

Reference

Other Resources

© 2009 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View