TextPattern.OutlineStylesAttribute フィールド

定義

テキスト範囲の OutlineStyles (OutlineStyles) 属性を識別します。

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

フィールド値

AutomationTextAttribute

次の例は、Microsoft メモ帳 でテキスト範囲の属性値を取得する方法を示しています。

注意

Microsoft メモ帳 は、例としてのみテキスト プロバイダーとして使用されます。 Microsoft メモ帳 は、要求されている属性値をサポートするとは限りません。

C#
private void GetOutlineStylesAttribute()
{
    // 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.OutlineStylesAttribute);
    if (oAttribute == TextPattern.MixedAttributeValue)
    {
        Console.WriteLine("Mixed outline styles.");
    }
    else
    {
        Console.WriteLine(oAttribute.ToString());
    }
}

注釈

この識別子は、クライアント アプリケーションUI オートメーション使用されます。 UI オートメーション プロバイダーでは、同等のフィールドTextPatternIdentifiersを使用する必要があります。

クライアントUI オートメーション呼び出GetAttributeValueすことによって属性の値を取得します。

この属性の値は型 OutlineStylesです。 既定値は None です。

適用対象

製品 バージョン
.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

こちらもご覧ください