TextPattern.MarginBottomAttribute Campo

Definição

Identifica o atributo MarginBottom (PageSettings) de um intervalo de texto.

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

Valor do campo

AutomationTextAttribute

Exemplos

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

Nota

O Microsoft Bloco de notas é usado como o provedor de texto somente para fins de exemplo. O Microsoft Bloco de notas não tem a garantia de dar suporte ao valor do atributo que está sendo solicitado.

C#
private void GetMarginBottomAttribute()
{
    // 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.MarginBottomAttribute);
    if (oAttribute == TextPattern.MixedAttributeValue)
    {
        Console.WriteLine("Mixed bottom margins.");
    }
    else
    {
        Console.WriteLine(oAttribute.ToString());
    }
}

Comentários

Esse atributo representa a margem inferior aplicada às páginas associadas ao intervalo de texto de chamada.

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 Double. O valor padrão é zero.

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
Windows Desktop 3.0, 3.1, 5, 6, 7

Confira também