Compartilhar via


ActionsPane Classe (sistema de 2007)

A classe que fornece a implementação para personalizar o Ações do documento tarefa painel personalizações em nível de documento para o Microsoft Office palavra e Microsoft Office Excel.

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

Sintaxe

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

Dim instance As ActionsPane
[PermissionSetAttribute(SecurityAction.Demand, Name = "FullTrust")]
public sealed class ActionsPane : RemoteComponent, 
    ISupportInitializeControl, ISupportInitialize

Comentários

Para obter mais informações sobre como criar painéis de ações em personalizações em nível de documento do palavra e Excel, consulte Visão geral painel Ações.

Exemplos

O exemplo de código a seguir demonstra como criar um painel de ações simples que ajusta automaticamente o alinhamento do seu Sumário.Quando o usuário altera a orientação do painel de ações, movendo o painel de ações para uma parte diferente da janela do aplicativo ou o usuário clica em um Button controle no painel de ações, o Orientation propriedade é usada para determinar o novo valor da StackOrder propriedade. Para executar este código telefonar o InitActionsPane método a partir do ThisWorkbook_Startup manipulador de eventos de um projeto do Excel.

PrivateSub InitActionsPane()
    With Globals.ThisWorkbook.ActionsPane
        .Clear()
        .Visible = True
        .AutoRecover = TrueEndWithAddHandler Globals.ThisWorkbook.ActionsPane.OrientationChanged, _
        AddressOf ActionsPane_OrientationChanged
    ResetStackOrder()

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

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

    Globals.ThisWorkbook.ActionsPane.Controls.AddRange(New Control() _
        {button1, button2, button3})
EndSub
' Switch the stack order according to the current orientation.PrivateSub button1_Click(ByVal sender AsObject, ByVal e As EventArgs)

    If Globals.ThisWorkbook.ActionsPane.Orientation = _
        Orientation.Horizontal ThenIf 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
        EndIfElseIf 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
        EndIfEndIfEndSubPrivateSub ActionsPane_OrientationChanged(ByVal sender AsObject, _
    ByVal e As EventArgs)
    ResetStackOrder()
EndSub
' Readjust the stack order so that it matches the current orientation.Sub ResetStackOrder()
    If Globals.ThisWorkbook.ActionsPane.Orientation = _
        Orientation.Horizontal ThenIf (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
        EndIfEndIfIf Globals.ThisWorkbook.ActionsPane.Orientation = _
        Orientation.Vertical ThenIf (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
        EndIfEndIfEndSub
privatevoid 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;
    }
}

Hierarquia de herança

System.Object
  Microsoft.VisualStudio.Tools.Office.RemoteComponent
    Microsoft.Office.Tools.ActionsPane

Acesso thread-safe

Quaisquer membros static (Shared no Visual Basic) públicos deste tipo são thread-safe. Não há garantia de que qualquer membro de instância seja thread-safe.

Consulte também

Referência

Membros ActionsPane

Namespace Microsoft.Office.Tools

Outros recursos

Visão geral painel Ações