ITextProvider.GetSelection 方法

定义

检索与当前文本选择(或多个文本选择)关联的不连续文本范围的集合。Retrieves a collection of disjoint text ranges associated with the current text selection or selections.

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

返回

ITextRangeProvider[]

不连续文本范围的集合。A collection of disjoint text ranges.

例外

如果 UI 自动化提供程序不支持文本选择。If the UI Automation provider does not support text selection.

注解

对于支持文本选择的 UI 自动化提供程序,提供程序应实现此方法并返回 SupportedTextSelection 值。For UI Automation providers that support text selection, the provider should implement this method and also return a SupportedTextSelection value.

如果未选择任何文本,则 GetSelection 将返回 (空范围) 的退化文本范围,该范围系统光标 (文本插入点) 。If no text is selected, GetSelection returns the degenerate text range (empty range) at the position of the system cursor (text insertion point).

如果系统光标 (文本插入点) 不存在,则 GetSelection 可能会 Nothing 在 Visual Basic) 中返回 (的空引用。If the system cursor (text insertion point) is not present, GetSelection may return a null reference (Nothing in Visual Basic).

适用于

另请参阅