Ler em inglês

Partilhar via


TextPattern.AnimationStyleAttribute Campo

Definição

Identifica o atributo AnimationStyle de um intervalo de texto.

C#
public static readonly System.Windows.Automation.AutomationTextAttribute AnimationStyleAttribute;

Valor do campo

Exemplos

O exemplo a seguir mostra como obter um valor de atributo para um intervalo de texto em Microsoft Bloco de Notas.

Nota

Microsoft Bloco de Notas é usado como o provedor de texto apenas para fins de exemplo. Microsoft Bloco de Notas não é garantido para dar suporte ao valor de atributo que está sendo solicitado.

C#
private void GetAnimationStyleAttribute()
{
    // Start application.
    Process p = Process.Start("Notepad.exe","text.txt");

    // target --> The root AutomationElement.
    AutomationElement target = AutomationElement.FromHandle(p.MainWindowHandle);

    // Specify the control type we're looking for, in this case 'Document'
    PropertyCondition cond = new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Document);

    AutomationElement textProvider = target.FindFirst(TreeScope.Descendants, cond);

    TextPattern textpatternPattern = textProvider.GetCurrentPattern(TextPattern.Pattern) as TextPattern;

    if (textpatternPattern == null)
    {
        Console.WriteLine("Root element does not contain a descendant that supports TextPattern.");
        return;
    }

    Object oAttribute = textpatternPattern.DocumentRange.GetAttributeValue(TextPattern.AnimationStyleAttribute);
    if (oAttribute == TextPattern.MixedAttributeValue)
    {
        Console.WriteLine("Mixed animation styles.");
    }
    else
    {
        Console.WriteLine(oAttribute.ToString());
    }
}

Comentários

As animações aparecem apenas na tela; o texto animado é impresso, mas o efeito de animação não.

Esse identificador é usado por aplicativos cliente Automação da Interface do Usuário. Automação da Interface do Usuário provedores devem usar o campo equivalente em TextPatternIdentifiers.

Automação da Interface do Usuário clientes obtêm o valor do atributo chamando GetAttributeValue.

Os valores para esse atributo são do tipo AnimationStyle. O valor padrão é None.

Aplica-se a

Produto Versões
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

Confira também