TextPatternRange.ExpandToEnclosingUnit(TextUnit) 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
텍스트 범위를 지정된 범위로 확장합니다 TextUnit.
public:
void ExpandToEnclosingUnit(System::Windows::Automation::Text::TextUnit unit);
public void ExpandToEnclosingUnit(System.Windows.Automation.Text.TextUnit unit);
member this.ExpandToEnclosingUnit : System.Windows.Automation.Text.TextUnit -> unit
Public Sub ExpandToEnclosingUnit (unit As TextUnit)
매개 변수
- unit
- TextUnit
텍스트 단위입니다.
예제
private void ExpandSelection(AutomationElement target)
{
// Specify the control type we're looking for, in this case 'Document'
PropertyCondition cond = new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Document);
// target --> The root AutomationElement.
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;
}
TextPatternRange[] currentSelection = textpatternPattern.GetSelection();
// Expand selection to include entire document
currentSelection[0].ExpandToEnclosingUnit(TextUnit.Document);
}
Private Sub ExpandSelection(ByVal target As AutomationElement)
' Specify the control type we're looking for, in this case 'Document'
Dim cond As PropertyCondition = New PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Document)
' target --> The root AutomationElement.
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 currentSelection As TextPatternRange() = textpatternPattern.GetSelection()
currentSelection(0).ExpandToEnclosingUnit(TextUnit.Document)
End Sub
설명
범위가 이미 지정된 단위의 정확한 수량인 경우 변경되지 않은 상태로 유지됩니다.
메서드가 ExpandToEnclosingUnit 성공적으로 실행되도록 하기 위해 백그라운드에서 일련의 작업이 수행됩니다.
텍스트 범위가 정규화됩니다. 즉, 텍스트 범위가 엔드포인트의 Start 퇴행성 범위로 축소되어 엔드포인트가 End 불필요하게 만들어집니다. 이 단계는 텍스트 범위가 경계에 걸쳐
unit있는 상황에서 모호성을 제거하는 데 필요합니다. 예를 들어 "{{" 및 "}"이 텍스트 범위 엔드포인트인 경우 "{U}RL https://www.microsoft.com/ 이 텍스트에 포함됩니다."결과 범위는 요청된 DocumentRange 경계의 시작 부분으로
unit뒤로 이동합니다.DocumentRange에서 요청된 수의
unit경계를 따라 범위를 앞으로 또는 뒤로 이동합니다.요청된 End 경계에 따라
unit엔드포인트를 이동하여 퇴행성 범위 상태에서 범위를 확장합니다.
Move() 및 ExpandToEnclosingUnit()에 대해 텍스트 범위를 조정하는 방법의 예
메모
이러한 단계는 화면 읽기 프로그램이 삽입 지점 또는 가상 커서 위치에서 전체 단어, 문장 또는 전체 단락을 읽는 것이 일반적이기 때문에 필요합니다.
ExpandToEnclosingUnit 는 숨겨진 텍스트와 표시되는 텍스트를 모두 적용합니다. UI 자동화 클라이언트는 IsHiddenAttribute 텍스트 표시 여부를 확인할 수 있습니다.
ExpandToEnclosingUnit지정된 컨트롤에서 지원되지 않는 경우 TextUnit 지원되는 다음으로 가장 TextUnit 큰 값으로 지연합니다.
가장 작은 단위에서 가장 큰 단위로 순서가 아래에 나열되어 있습니다.