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.

public:
 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()

返回

ITextRangeProvider[]

容器内可见文本范围的集合或者一个空数组。The collection of visible text ranges within the container or an empty array. 从不返回空引用(在 Visual Basic 中为 Nothing)。A null reference (Nothing in Visual Basic) is never returned.

注解

UI 自动化提供程序应确保它们最多返回容器内可见的文本范围。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.

适用于

另请参阅