TextPattern.CultureAttribute 필드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
Culture 텍스트 범위의 (CultureInfo) 특성을 하위 언어 수준(예: 프랑스어(fr) 대신 French-Switzerland(fr-CH)로 식별합니다.
public: static initonly System::Windows::Automation::AutomationTextAttribute ^ CultureAttribute;
public static readonly System.Windows.Automation.AutomationTextAttribute CultureAttribute;
staticval mutable CultureAttribute : System.Windows.Automation.AutomationTextAttribute
Public Shared ReadOnly CultureAttribute As AutomationTextAttribute
필드 값
예제
다음 예제에서는 Microsoft 메모장에서 텍스트 범위에 대한 특성 값을 가져오는 방법을 보여줍니다.
메모
Microsoft 메모장만 텍스트 공급자로 사용됩니다. Microsoft 메모장에서 요청되는 특성 값을 지원하지 않습니다.
private void GetCultureAttribute()
{
// 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.CultureAttribute);
if (oAttribute == TextPattern.MixedAttributeValue)
{
Console.WriteLine("Mixed culture info.");
}
else
{
Console.WriteLine(oAttribute.ToString());
}
}
Private Sub GetCultureAttribute()
' 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.CultureAttribute)
If (oAttribute = TextPattern.MixedAttributeValue) Then
Console.WriteLine("Mixed culture info.")
Else
Console.WriteLine(oAttribute.ToString())
End If
End Sub
설명
이 식별자는 UI 자동화 클라이언트 애플리케이션에서 사용됩니다. UI 자동화 공급자는 TextPatternIdentifiers 해당 필드를 사용해야 합니다.
UI 자동화 클라이언트는 GetAttributeValue 호출하여 특성의 값을 가져옵니다.
이 특성의 값은 형식 CultureInfo입니다. 기본값은 애플리케이션 사용자 인터페이스의 언어입니다.
언어 코드 형식에 대한 자세한 내용은 참조 CultureInfo 하세요.
메모
서버에서 언어 태그를 지원하지 않거나 작성자가 사용할 수 없는 경우가 있을 수 있습니다. 이 경우 기본값이 적용됩니다.