TextPattern.OutlineStylesAttribute 필드

정의

텍스트 범위의 OutlineStyles(OutlineStyles) 특성을 식별합니다.

public: static initonly System::Windows::Automation::AutomationTextAttribute ^ OutlineStylesAttribute;
public static readonly System.Windows.Automation.AutomationTextAttribute OutlineStylesAttribute;
 staticval mutable OutlineStylesAttribute : System.Windows.Automation.AutomationTextAttribute
Public Shared ReadOnly OutlineStylesAttribute As AutomationTextAttribute 

필드 값

AutomationTextAttribute

예제

다음 예제에서는 Microsoft 메모장의 텍스트 범위에 대 한 특성 값을 가져오는 방법을 보여 줍니다.

참고

Microsoft 메모장 텍스트 공급자 예를 들어 목적 으로만 사용 됩니다. 요청 된 특성 값을 지원 하도록 Microsoft 메모장 보장 되지 않습니다.

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());
    }
}
Private Sub GetOutlineStylesAttribute()
    ' Start application.
    Dim p As Process = Process.Start("Notepad.exe", "text.txt")

    ' target --> The root AutomationElement.
    Dim target As AutomationElement = AutomationElement.FromHandle(p.MainWindowHandle)

    ' Specify the control type we're looking for, in this case 'Document'
    Dim cond As PropertyCondition = New PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Document)

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

    Dim textpatternPattern As TextPattern = CType(textProvider.GetCurrentPattern(TextPattern.Pattern), TextPattern)

    If (textpatternPattern Is Nothing) Then
        Console.WriteLine("Root element does not contain a descendant that supports TextPattern.")
        Return
    End If

    Dim oAttribute As Object = textpatternPattern.DocumentRange.GetAttributeValue(TextPattern.OutlineStylesAttribute)
    If (oAttribute = TextPattern.MixedAttributeValue) Then
        Console.WriteLine("Mixed outline styles.")
    Else
        Console.WriteLine(oAttribute.ToString())
    End If
End Sub

설명

이 식별자는 UI 자동화 클라이언트 애플리케이션에서 사용 됩니다. UI 자동화 공급자의 해당 필드를 사용 해야 TextPatternIdentifiers합니다.

UI 자동화 클라이언트를 호출 하 여 특성의 값을 가져올 GetAttributeValue합니다.

이 특성의 값은 형식의 OutlineStyles합니다. 기본값은 None입니다.

적용 대상

추가 정보