ViewFilter.GetSelection 方法

返回当前选定的文本区域。

命名空间:  Microsoft.VisualStudio.Package
程序集:   Microsoft.VisualStudio.Package.LanguageService(在 Microsoft.VisualStudio.Package.LanguageService.dll 中)
  Microsoft.VisualStudio.Package.LanguageService.10.0(在 Microsoft.VisualStudio.Package.LanguageService.10.0.dll 中)
  Microsoft.VisualStudio.Package.LanguageService.9.0(在 Microsoft.VisualStudio.Package.LanguageService.9.0.dll 中)
  Microsoft.VisualStudio.Package.LanguageService.11.0(在 Microsoft.VisualStudio.Package.LanguageService.11.0.dll 中)

语法

声明
Public Function GetSelection As TextSpan
public TextSpan GetSelection()

返回值

类型:Microsoft.VisualStudio.TextManager.Interop.TextSpan
返回指定文本的选定范围 TextSpan 对象。

备注

此方法调用 IVsTextView 对象的 GetSelectionSpan 方法将传递给 ViewFilter 类构造函数。 ,如果未选定文本,生成的 TextSpan 对象包含选定的文本或插入符号的位置的范围。

.NET Framework 安全性

请参见

参考

ViewFilter 类

Microsoft.VisualStudio.Package 命名空间