TextPattern.GetVisibleRanges メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
各テキスト範囲が最初の部分的に表示される行から最後に部分的に表示される行の末尾まで開始するテキスト コンテナーから、不整合なテキスト範囲の配列を取得します。
public:
cli::array <System::Windows::Automation::Text::TextPatternRange ^> ^ GetVisibleRanges();
public System.Windows.Automation.Text.TextPatternRange[] GetVisibleRanges();
member this.GetVisibleRanges : unit -> System.Windows.Automation.Text.TextPatternRange[]
Public Function GetVisibleRanges () As TextPatternRange()
返品
コンテナー内または空の配列内に表示されるテキスト範囲のコレクション。
Null は返されません。
例
private TextPatternRange[] CurrentVisibleRanges(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 null;
}
return textpatternPattern.GetVisibleRanges();
}
Private Function CurrentVisibleRanges(ByVal target As AutomationElement) As TextPatternRange()
' 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 Nothing
End If
Return textpatternPattern.GetVisibleRanges()
End Function
注釈
結合されていないテキスト範囲は、テキスト コンテナーのコンテンツが重なり合うウィンドウまたはその他のオブジェクトによって隠れている場合、または複数列レイアウトのテキスト コンテナーで 1 つ以上の列が部分的にスクロールされた場合に発生する可能性があります。
テキストが表示されない場合は、縮退した (空の) テキスト範囲が返されます。 この空の範囲は、テキスト コンテナーが空の場合、またはすべてのテキストが表示されない場合に返されます。