Поделиться через


ActionsPane Interface

Represents a custom user interface for the Document Actions task pane in a document-level customization for Word or Excel.

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

Syntax

'Declaration
<GuidAttribute("b835a67a-c3c0-45ba-9a3f-c878bf531dd5")> _
Public Interface ActionsPane _
    Inherits IDisposable
[GuidAttribute("b835a67a-c3c0-45ba-9a3f-c878bf531dd5")]
public interface ActionsPane : IDisposable

The ActionsPane type exposes the following members.

Properties

  Name Description
Public property AccessibilityObject Gets the AccessibleObject that is assigned to the actions pane.
Public property AccessibleDefaultActionDescription Gets or sets the default action description of the actions pane. This description is used by accessibility client applications.
Public property AccessibleDescription Gets or sets the accessible description of the actions pane. This description is used by accessibility client applications.
Public property AccessibleName Gets or sets the accessible name of the actions pane. This name is used by accessibility client applications.
Public property AccessibleRole Gets or sets the accessible role of the actions pane.
Public property ActiveControl Gets or sets the active control on the actions pane.
Public property AllowDrop Gets or sets a value that indicates whether the actions pane can accept data that the user drags onto it.
Public property Anchor Gets or sets the edges of the container to which the actions pane is bound and determines how the user control is resized with its parent.
Public property AutoRecover Gets or sets a value that indicates whether the actions pane solution automatically re-attaches to the document when it is detached.
Public property AutoScaleDimensions Gets or sets the dimensions that the actions pane was designed to.
Public property AutoScaleMode Gets or sets the automatic scaling mode of the actions pane.
Public property AutoScroll Gets or sets a value indicating whether the actions pane enables the user to scroll to any controls placed outside of its visible boundaries.
Public property AutoScrollMargin Gets or sets the size of the auto-scroll margin for the actions pane.
Public property AutoScrollMinSize Gets or sets the minimum size of the auto-scroll for the actions pane.
Public property AutoScrollOffset Gets or sets where the actions pane is scrolled to when the ScrollControlIntoView method is called.
Public property AutoScrollPosition Gets or sets the location of the auto-scroll position for the actions pane.
Public property AutoSize Infrastructure. This property is not supported by the actions pane.
Public property AutoSizeMode Gets or sets the mode by which the actions pane control automatically resizes itself.
Public property AutoValidate Gets or sets a value that indicates whether controls in the actions pane will be automatically validated when the focus changes.
Public property BackColor Gets or sets the background color for the actions pane.
Public property BackgroundImage Gets or sets the background image displayed in the actions pane.
Public property BackgroundImageLayout Gets or sets the position and behavior of a background image in the actions pane.
Public property BindingContext Gets or sets an object that is used to keep all controls on the actions pane that are bound to the same data source synchronized.
Public property BorderStyle Gets or sets the border style of the actions pane.
Public property Bottom Gets the distance, in pixels, between the bottom edge of the actions pane and the top edge of its container's client area.
Public property Bounds Gets or sets the size and location of the actions pane control including its nonclient elements, in pixels, relative to its parent.
Public property CanFocus Gets a value indicating whether the actions pane can receive focus.
Public property CanSelect Gets a value indicating whether the actions pane can be selected.
Public property Capture Gets or sets a value indicating whether the actions pane has captured the mouse.
Public property CausesValidation Gets or sets a value indicating whether the actions pane causes validation to be performed on any controls that require validation when it receives focus.
Public property ClientRectangle Gets the rectangle that represents the client area of the actions pane.
Public property ClientSize Gets or sets the height and width of the client area of the actions pane.
Public property CompanyName Gets the name of the company or creator of the application containing the actions pane.
Public property Container Infrastructure. This property is not supported by the actions pane.
Public property ContainsFocus Gets a value indicating whether the actions pane, or one of its child controls, currently has the input focus.
Public property ContextMenu Gets or sets the shortcut menu associated with the actions pane.
Public property ContextMenuStrip Gets or sets the ContextMenuStrip associated with the actions pane.
Public property Controls Gets the collection of controls contained within the actions pane.
Public property Created Gets a value indicating whether the actions pane has been created.
Public property CurrentAutoScaleDimensions Gets the current run-time dimensions of the screen.
Public property Cursor Gets or sets the cursor that is displayed when the mouse pointer is over the actions pane.
Public property DataBindings Gets the data bindings for the actions pane.
Public property DisplayRectangle Gets the rectangle that represents the display area of the actions pane.
Public property Disposing Gets a value indicating whether the actions pane is in the process of disposing.
Public property Dock Gets or sets which actions pane control borders are docked to its parent and determines how the actions pane control is resized with its parent.
Public property DockPadding Infrastructure. This property is not supported by the actions pane.
Public property Enabled Gets or sets a value indicating whether the actions pane can respond to user interaction.
Public property Focused Gets a value indicating whether the actions pane has input focus.
Public property Font Gets or sets the font of the text displayed by the actions pane.
Public property ForeColor Gets or sets the foreground color of the actions pane.
Public property Handle Gets the window handle that the actions pane control is bound to.
Public property HasChildren Gets a value that indicates whether the control contains one or more child controls.
Public property Height Gets or sets the height of the actions pane control.
Public property HorizontalScroll Gets the characteristics associated with the horizontal scroll bar.
Public property ImeMode Gets or sets the Input Method Editor (IME) mode of the actions pane.
Public property InvokeRequired Gets a value indicating whether the caller must call an invoke method when making method calls to the actions pane control because the caller is on a different thread than the one the actions pane control was created on.
Public property IsAccessible Gets or sets a value that indicates whether the actions pane is visible to accessibility applications.
Public property IsDisposed Gets a value that indicates whether the actions pane control has been disposed of.
Public property IsHandleCreated Gets a value that indicates whether the actions pane control has a handle associated with it.
Public property IsMirrored Gets a value that indicates whether the actions pane is mirrored.
Public property LayoutEngine Gets a cached instance of the actions pane control's layout engine.
Public property Left Gets or sets the distance, in pixels, between the left edge of the actions pane control and the left edge of its container's client area.
Public property Location Gets or sets the coordinates of the upper-left corner of the actions pane relative to the upper-left corner of its container.
Public property Margin Gets or sets the space between controls.
Public property MaximumSize Gets or sets the size that is the upper limit that GetPreferredSize can specify.
Public property MinimumSize Gets or sets the size that is the lower limit that GetPreferredSize can specify.
Public property Name Gets or sets the name of the actions pane control.
Public property Orientation Gets a value that indicates whether the placement of the actions pane is vertical or horizontal.
Public property Padding Gets or sets padding within the actions pane.
Public property Parent Gets or sets the parent container of the actions pane.
Public property ParentForm Infrastructure. This property is not supported by the actions pane.
Public property PreferredSize Gets the size of the rectangular area into which the actions pane can fit.
Public property ProductName Gets the product name of the assembly that contains the actions pane.
Public property ProductVersion Gets the version of the assembly that contains the actions pane.
Public property RecreatingHandle Gets a value that indicates whether the actions pane control is currently re-creating its handle.
Public property Region Gets or sets the window region associated with the actions pane.
Public property Right Gets the distance, in pixels, between the right edge of the actions pane and the left edge of its container's client area.
Public property RightToLeft Gets or sets a value indicating whether the actions pane's elements are aligned to support locales using right-to-left fonts.
Public property Site Gets or sets the site of the actions pane.
Public property Size Gets or sets the height and width of the actions pane control.
Public property StackOrder Gets or sets a value that indicates the direction that the controls are stacked on the actions pane.
Public property TabIndex Gets or sets the tab order of the actions pane within its container.
Public property TabStop Gets or sets a value indicating whether the user can give the focus to the actions pane by using the TAB key.
Public property Tag Gets or sets the object that contains data about the actions pane.
Public property Text Infrastructure. This property is not supported by the actions pane.
Public property Top Gets or sets the distance, in pixels, between the top edge of the actions pane control and the top edge of its container's client area.
Public property TopLevelControl Infrastructure. This property is not supported by the actions pane.
Public property UseWaitCursor Gets or sets a value indicating whether to use the wait cursor for the actions pane and all child controls.
Public property VerticalScroll Gets the characteristics associated with the vertical scroll bar.
Public property Visible Gets or sets a value that indicates whether the ActionsPane is visible.
Public property Width Gets or sets the width of the actions pane control.
Public property WindowTarget Infrastructure. This property is not supported by the actions pane.

Top

Methods

  Name Description
Public method BeginInit Infrastructure.
Public method BeginInvoke(Delegate) Executes the specified delegate asynchronously on the thread that the actions pane control's underlying handle was created on.
Public method BeginInvoke(Delegate, array<Object[]) Executes the specified delegate asynchronously with the specified arguments, on the thread that the actions pane control's underlying handle was created on.
Public method BringToFront Brings the actions pane control to the front of the z-order.
Public method Clear Detaches the actions pane solution from the document.
Public method Contains Returns a value that indicates whether the specified control is a child of the actions pane.
Public method CreateControl Forces the creation of the visible actions pane control, including the creation of the handle and any visible child controls.
Public method CreateGraphics Creates the Graphics for the actions pane control.
Public method Dispose Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from IDisposable.)
Public method DoDragDrop Begins a drag-and-drop operation.
Public method DrawToBitmap Supports rendering to the specified bitmap.
Public method EndInit Infrastructure.
Public method EndInvoke Retrieves the return value of the specified asynchronous operation.
Public method FindForm Retrieves the form that the actions pane control is on.
Public method Focus Sets input focus to the actions pane.
Public method GetChildAtPoint(Point) Retrieves the child control that is located at the specified coordinates.
Public method GetChildAtPoint(Point, GetChildAtPointSkip) Retrieves the child control that is located at the specified coordinates, specifying whether to ignore child controls of a certain type.
Public method GetContainerControl Returns the next ContainerControl up the control's chain of parent controls.
Public method GetNextControl Retrieves the next control forward or back in the tab order of child controls.
Public method GetPreferredSize Retrieves the size of a rectangular area into which the actions pane can be fitted.
Public method Hide Removes the ActionsPane and the controls from the task pane user interface, but leaves the task pane visible.
Public method Invalidate() Invalidates the entire surface of the actions pane and causes the actions pane to be redrawn.
Public method Invalidate(Boolean) Invalidates the entire surface of the actions pane and causes a paint message to be sent to the actions pane. Optionally, invalidates the child controls assigned to the actions pane.
Public method Invalidate(Rectangle) Invalidates the specified region of the actions pane (adds it to the actions pane's update region, which is the area that will be repainted at the next paint operation), and causes a paint message to be sent to the actions pane.
Public method Invalidate(Region) Invalidates the specified region of the actions pane (adds it to the actions pane's update region, which is the area that will be repainted at the next paint operation), and causes a paint message to be sent to the actions pane.
Public method Invalidate(Rectangle, Boolean) Invalidates the specified region of the actions pane (adds it to the actions pane's update region, which is the area that will be repainted at the next paint operation), and causes a paint message to be sent to the actions pane. Optionally, invalidates the child controls assigned to the actions pane.
Public method Invalidate(Region, Boolean) Invalidates the specified region of the actions pane (adds it to the actions pane's update region, which is the area that will be repainted at the next paint operation), and causes a paint message to be sent to the actions pane. Optionally, invalidates the child controls assigned to the actions pane.
Public method Invoke(Delegate) Executes the specified delegate on the thread that owns the actions pane's underlying window handle.
Public method Invoke(Delegate, array<Object[]) Executes the specified delegate, on the thread that owns the actions pane's underlying window handle, with the specified list of arguments.
Public method PerformAutoScale Performs scaling of the actions pane and its children.
Public method PerformLayout() Forces the actions pane to apply layout logic to all its child controls.
Public method PerformLayout(Control, String) Forces the actions pane to apply layout logic to all its child controls.
Public method PointToClient Computes the location of the specified screen point into client coordinates.
Public method PointToScreen Computes the location of the specified client point into screen coordinates.
Public method PreProcessControlMessage Preprocesses keyboard or input messages within the message loop before they are dispatched.
Public method PreProcessMessage Preprocesses keyboard or input messages within the message loop before they are dispatched.
Public method RectangleToClient Computes the size and location of the specified screen rectangle in client coordinates.
Public method RectangleToScreen Computes the size and location of the specified client rectangle in screen coordinates.
Public method Refresh Forces the actions pane to invalidate its client area and immediately redraw itself and any child controls.
Public method ResetBackColor Infrastructure. This method is not supported by the actions pane.
Public method ResetBindings Infrastructure. This method is not supported by the actions pane.
Public method ResetCursor Infrastructure. This method is not supported by the actions pane.
Public method ResetFont Infrastructure. This method is not supported by the actions pane.
Public method ResetForeColor Infrastructure. This method is not supported by the actions pane.
Public method ResetImeMode Infrastructure. This method is not supported by the actions pane.
Public method ResetRightToLeft Infrastructure. This method is not supported by the actions pane.
Public method ResetText Infrastructure. This method is not supported by the actions pane.
Public method ResumeLayout() Resumes usual layout logic.
Public method ResumeLayout(Boolean) Resumes usual layout logic, optionally forcing an immediate layout of pending layout requests.
Public method Scale Scales the actions pane and all child controls by the specified scaling factor.
Public method ScrollControlIntoView Scrolls the specified child control into view.
Public method Select Activates the actions pane.
Public method SelectNextControl Activates the next control.
Public method SendToBack Sends the actions pane control to the back of the z-order.
Public method SetAutoScrollMargin Sets the size of the auto-scroll margins.
Public method SetBounds(Int32, Int32, Int32, Int32) Sets the bounds of the actions pane to the specified location and size.
Public method SetBounds(Int32, Int32, Int32, Int32, BoundsSpecified) Sets the specified bounds of the actions pane to the specified location and size.
Public method Show Displays the ActionsPane on the task pane, including all controls that have been added to the ActionsPane, but does not display the task pane if the task pane is not visible.
Public method SuspendLayout Temporarily suspends the layout logic for the actions pane.
Public method Update Causes the actions pane to redraw the invalidated regions within its client area.
Public method Validate() Verifies the contents of the actions pane by causing the Validating and Validated events to occur, in that order.
Public method Validate(Boolean) Verifies the contents of the actions pane; conditionally dependent on whether automatic validation is turned on.
Public method ValidateChildren() Causes all of the child controls that support validation to validate their data.
Public method ValidateChildren(ValidationConstraints) Causes all of the child controls that support validation to validate their data.

Top

Events

  Name Description
Public event AutoSizeChanged Infrastructure. This event is not supported by the actions pane.
Public event AutoValidateChanged Occurs when the AutoValidate property changes.
Public event BackColorChanged Occurs when the value of the BackColor property changes.
Public event BackgroundImageChanged Occurs when the value of the BackgroundImage property changes.
Public event BackgroundImageLayoutChanged Occurs when the BackgroundImageLayout property changes.
Public event BindingContextChanged Occurs when the value of the BindingContext property changes.
Public event CausesValidationChanged Occurs when the value of the CausesValidation property changes.
Public event ChangeUICues Occurs when the focus or keyboard user interface (UI) cues change.
Public event Click Occurs when the actions pane is clicked.
Public event ClientSizeChanged Occurs when the value of the ClientSize property changes.
Public event ContextMenuChanged Occurs when the value of the ContextMenu property changes.
Public event ContextMenuStripChanged Occurs when the value of the ContextMenuStrip property changes.
Public event ControlAdded Occurs when a new control is added to the Controls collection.
Public event ControlRemoved Occurs when a control is removed from the Controls collection.
Public event CursorChanged Occurs when the value of the Cursor property changes.
Public event Disposed Occurs when the actions pane is disposed.
Public event DockChanged Occurs when the value of the Dock property changes.
Public event DoubleClick Occurs when the actions pane is double-clicked.
Public event DragDrop Occurs when a drag-and-drop operation is completed.
Public event DragEnter Occurs when an object is dragged into the actions pane's bounds.
Public event DragLeave Occurs when an object is dragged out of the actions pane's bounds.
Public event DragOver Occurs when an object is dragged over the actions pane's bounds.
Public event EnabledChanged Occurs when the Enabled property value has changed.
Public event Enter Occurs when the actions pane is entered.
Public event FontChanged Occurs when the Font property value changes.
Public event ForeColorChanged Occurs when the ForeColor property value changes.
Public event GiveFeedback Occurs during a drag operation.
Public event GotFocus Occurs when the actions pane receives focus.
Public event HandleCreated Occurs when a handle is created for the actions pane.
Public event HandleDestroyed Occurs when the actions pane's handle is in the process of being destroyed.
Public event HelpRequested Occurs when the user requests help for the actions pane.
Public event ImeModeChanged Occurs when the ImeMode property changes.
Public event Invalidated Occurs when the actions pane's display requires redrawing.
Public event KeyDown Occurs when a key is pressed while the actions pane has focus.
Public event KeyPress Occurs when a key is pressed while the actions pane has focus.
Public event KeyUp Occurs when a key is released while the actions pane has focus.
Public event Layout Occurs when the actions pane should reposition its child controls.
Public event Leave Occurs when the input focus leaves the actions pane.
Public event Load Occurs before the actions pane becomes visible for the first time.
Public event LocationChanged Occurs when the Location property value has changed.
Public event LostFocus Occurs when the actions pane loses focus.
Public event MarginChanged Occurs when the actions pane's margin changes.
Public event MouseCaptureChanged Occurs when the actions pane loses or gains mouse capture.
Public event MouseClick Occurs when the actions pane is clicked by the mouse.
Public event MouseDoubleClick Occurs when the actions pane is double clicked by the mouse.
Public event MouseDown Occurs when the mouse pointer is over the actions pane and a mouse button is pressed.
Public event MouseEnter Occurs when the mouse pointer enters the actions pane.
Public event MouseHover Occurs when the mouse pointer rests on the actions pane.
Public event MouseLeave Occurs when the mouse pointer leaves the actions pane.
Public event MouseMove Occurs when the mouse pointer is moved over the actions pane.
Public event MouseUp Occurs when the mouse pointer is over the actions pane and a mouse button is released.
Public event MouseWheel Occurs when the mouse wheel moves while the actions pane has focus.
Public event Move Occurs when the actions pane is moved.
Public event OrientationChanged Occurs when the Orientation of the actions pane changes.
Public event PaddingChanged Occurs when the actions pane's padding changes.
Public event Paint Occurs when the actions pane is redrawn.
Public event ParentChanged Occurs when the Parent property value changes.
Public event PreviewKeyDown Occurs before the KeyDown event when a key is pressed while focus is on this control.
Public event QueryAccessibilityHelp Occurs when an AccessibleObject is providing help to accessibility applications.
Public event QueryContinueDrag Occurs during a drag-and-drop operation and enables the drag source to determine whether the drag-and-drop operation should be canceled.
Public event RegionChanged Occurs when the value of the Region property changes.
Public event Resize Occurs when the actions pane is resized.
Public event RightToLeftChanged Occurs when the RightToLeft property value changes.
Public event Scroll Occurs when the user or code scrolls through the client area.
Public event SizeChanged Occurs when the Size property value changes.
Public event StyleChanged Occurs when the actions pane style changes.
Public event SystemColorsChanged Occurs when the system colors change.
Public event TabIndexChanged Occurs when the TabIndex property value changes.
Public event TabStopChanged Occurs when the TabStop property value changes.
Public event TextChanged Infrastructure. This event is not supported by the actions pane.
Public event Validated Occurs when the actions pane is finished validating.
Public event Validating Occurs when the actions pane is validating.
Public event VisibleChanged Occurs when the Visible property value changes.

Top

Remarks

Every document-level customization for Excel or Word exposes an ActionsPane object. You can use this object to customize the user interface of the Document Actions task pane in a document-level project. To get the ActionsPane object, use the ActionsPane field of the ThisDocument class (for Word) or the ThisWorkbook class (for Excel) in your project. For more information, see Actions Pane Overview.

Each ActionsPane object extends an underlying Windows Forms UserControl that provides a user interface that you can customize. Most of the ActionsPane members correspond to members of the underlying UserControl. Use the following ActionsPane members to access actions pane-specific functionality:

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

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

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

  • 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.

Note

This interface is implemented by the Visual Studio Tools for Office runtime. It is not intended to be implemented in your code. For more information, see Visual Studio Tools for Office Runtime Overview.

Usage

This documentation describes the version of this type that is used in Office projects that target the .NET Framework 4. In projects that target the .NET Framework 3.5, this type might have different members and the code examples provided for this type might not work. For documentation about this type in projects that target the .NET Framework 3.5, see the following reference section in the Visual Studio 2008 documentation: https://go.microsoft.com/fwlink/?LinkId=160658.

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
private void InitActionsPane()
{
    Globals.ThisWorkbook.ActionsPane.Clear();
    Globals.ThisWorkbook.ActionsPane.Visible = true;
    Globals.ThisWorkbook.ActionsPane.AutoRecover = true;
    Globals.ThisWorkbook.ActionsPane.OrientationChanged +=
        new EventHandler(ActionsPane_OrientationChanged);
    ResetStackOrder();

    // Create the button that will update the stack order.
    Button button1 = new Button();
    button1.Text = "Change stack order";
    button1.Click += new EventHandler(button1_Click);

    // Create two more buttons that do nothing.
    Button button2 = new Button();
    button2.Text = "Button 2";
    Button button3 = new Button();
    button3.Text = "Button 3";

    Globals.ThisWorkbook.ActionsPane.Controls.AddRange(
        new Control[] { button1, button2, button3 });
}

// Switch the stack order according to the current orientation.
void button1_Click(object sender, EventArgs e)
{
    if (Globals.ThisWorkbook.ActionsPane.Orientation == 
        Orientation.Horizontal)
    {
        if (Globals.ThisWorkbook.ActionsPane.StackOrder == 
            Microsoft.Office.Tools.StackStyle.FromLeft)
        {
            Globals.ThisWorkbook.ActionsPane.StackOrder =
                Microsoft.Office.Tools.StackStyle.FromRight;
        }
        else
        {
            Globals.ThisWorkbook.ActionsPane.StackOrder =
                Microsoft.Office.Tools.StackStyle.FromLeft;
        }
    }
    else
    {
        if (Globals.ThisWorkbook.ActionsPane.StackOrder ==
            Microsoft.Office.Tools.StackStyle.FromTop)
        {
            Globals.ThisWorkbook.ActionsPane.StackOrder =
                Microsoft.Office.Tools.StackStyle.FromBottom;
        }
        else
        {
            Globals.ThisWorkbook.ActionsPane.StackOrder =
                Microsoft.Office.Tools.StackStyle.FromTop;
        }
    }
}

void ActionsPane_OrientationChanged(object sender, EventArgs e)
{
    ResetStackOrder();
}

// Readjust the stack order so that it matches the current orientation.
void ResetStackOrder()
{
    if (Globals.ThisWorkbook.ActionsPane.Orientation == 
        Orientation.Horizontal &&
       (Globals.ThisWorkbook.ActionsPane.StackOrder == 
           Microsoft.Office.Tools.StackStyle.FromTop ||
        Globals.ThisWorkbook.ActionsPane.StackOrder ==
           Microsoft.Office.Tools.StackStyle.FromBottom))
    {
        Globals.ThisWorkbook.ActionsPane.StackOrder =
            Microsoft.Office.Tools.StackStyle.FromLeft;
    }

    if (Globals.ThisWorkbook.ActionsPane.Orientation == 
        Orientation.Vertical &&
       (Globals.ThisWorkbook.ActionsPane.StackOrder ==
           Microsoft.Office.Tools.StackStyle.FromLeft ||
        Globals.ThisWorkbook.ActionsPane.StackOrder ==
           Microsoft.Office.Tools.StackStyle.FromRight))
    {
        Globals.ThisWorkbook.ActionsPane.StackOrder =
            Microsoft.Office.Tools.StackStyle.FromTop;
    }
}

See Also

Reference

Microsoft.Office.Tools Namespace

Other Resources

Actions Pane Overview