ITextProvider.GetVisibleRanges 方法


從文字容器擷取斷續文字範圍的陣列,其中每一個文字範圍都以第一個局部可見行開頭,一直到最後一個局部可見行的尾端為止。Retrieves an array of disjoint text ranges from a text container where each text range begins with the first partially visible line through to the end of the last partially visible line.

 cli::array <System::Windows::Automation::Provider::ITextRangeProvider ^> ^ GetVisibleRanges();
public System.Windows.Automation.Provider.ITextRangeProvider[] GetVisibleRanges ();
abstract member GetVisibleRanges : unit -> System.Windows.Automation.Provider.ITextRangeProvider[]
Public Function GetVisibleRanges () As ITextRangeProvider()



容器內可見文字範圍的集合或空陣列。The collection of visible text ranges within the container or an empty array. 從未傳回 Null 參考 (在 Visual Basic 中為 Nothing)。A null reference (Nothing in Visual Basic) is never returned.


消費者介面自動化提供者應該確保它們最常傳回容器中可見的文字範圍。UI Automation providers should ensure that they return, at most, the text ranges that are visible within the container.

當文字容器的任何內容被重迭的視窗或其他物件遮蔽,或是具有多重資料行版面配置的文字容器有一或多個資料行的局部滾動時,就可能會發生不連續的文字範圍。Disjoint text ranges may occur when any content of a text container is obscured by an overlapping window or other object, or when a text container with a multi-column layout has one or more columns partially scrolled out of view.

如果沒有顯示任何文字,則會傳回 (空白) 文字範圍的退化。If no text is visible, a degenerate (empty) text range is returned. 如果文字容器是空的,或當所有文字都未顯示時,就會傳回此空範圍。This empty range can be returned if the text container is empty or when all text is scrolled out of view.