,如果有一个,返回文本范围与当前选择对应。
命名空间: Microsoft.VisualStudio.TextManager.Interop
程序集: Microsoft.VisualStudio.TextManager.Interop(在 Microsoft.VisualStudio.TextManager.Interop.dll 中)
语法
声明
Function GetSelection ( _
<OutAttribute> ByRef piAnchorLine As Integer, _
<OutAttribute> ByRef piAnchorCol As Integer, _
<OutAttribute> ByRef piEndLine As Integer, _
<OutAttribute> ByRef piEndCol As Integer _
) As Integer
int GetSelection(
out int piAnchorLine,
out int piAnchorCol,
out int piEndLine,
out int piEndCol
)
int GetSelection(
[OutAttribute] int% piAnchorLine,
[OutAttribute] int% piAnchorCol,
[OutAttribute] int% piEndLine,
[OutAttribute] int% piEndCol
)
abstract GetSelection :
piAnchorLine:int byref *
piAnchorCol:int byref *
piEndLine:int byref *
piEndCol:int byref -> int
function GetSelection(
piAnchorLine : int,
piAnchorCol : int,
piEndLine : int,
piEndCol : int
) : int
参数
piAnchorLine
类型:Int32%[out] 定位点选择的行位置。 基于用户的选择,此值不一定是在选定内容顶行。
piAnchorCol
类型:Int32%[out] 定位点选择的列位置。 基于用户的选择,此值不一定是在选定内容的顶部,左列位置。 Viewcol 坐标可以包括虚拟空间。
piEndLine
类型:Int32%[out] 结束选择的行位置。 基于用户的选择,此值不一定是在选定内容的下半部分行。
piEndCol
类型:Int32%[out] 选择的结尾列位置。 基于用户的选择,此值不一定是在选定内容的更低,正确的列位置。 Viewcol 坐标可以包括虚拟空间。
返回值
类型:Int32
如果方法成功,则返回 S_OK。如果失败,它会返回一个错误代码。
备注
COM 签名
从 textmgr.idl:
HRESULT IVsTextView::GetSelection(
[out] long *piAnchorLine,
[out] ViewCol *piAnchorCol,
[out] long *piEndLine,
[out] ViewCol *piEndCol
);
,如果它们不需要的确定选定内容, GetSelection 的参数可以是 nullnull 引用(在 Visual Basic 中为 Nothing) 。 若要返回在 TextSpan 结构中的此信息,调用 GetSelectionSpan 方法。
备注
定位点位置不总是在文本视图的左边或顶端位置。例如,在 10 行的大小,用户可以锚定它们在第 10 行的选择和结束其行中的 1 中选择,从而反转所需的定位点/行顺序。
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关详细信息,请参阅通过部分受信任的代码使用库。