TextSelection.ActivePoint プロパティ

更新 : 2007 年 11 月

選択範囲の現在の終点を取得します。

名前空間 :  EnvDTE
アセンブリ :  EnvDTE (EnvDTE.dll 内)

構文

'宣言
ReadOnly Property ActivePoint As VirtualPoint
'使用
Dim instance As TextSelection
Dim value As VirtualPoint

value = instance.ActivePoint
VirtualPoint ActivePoint { get; }
property VirtualPoint^ ActivePoint {
    VirtualPoint^ get ();
}
function get ActivePoint () : VirtualPoint

プロパティ値

型 : EnvDTE.VirtualPoint

VirtualPoint オブジェクト。

解説

TextPoint オブジェクトは、エディタ ウィンドウで選択したテキストの位置を示しますが、バッファの位置をマークするわけではありません。行末を越えた領域である仮想空間も、エディタ ウィンドウ内でのみ追跡されます。したがって、テキスト バッファで EditPoint オブジェクトを使用してテキストを変更したときに、選択したテキストに対して何が起こるかは定義されていません。たとえば、選択したテキストで開始し、エディット ポイントを取得して、バッファを変更するコマンドがあるとします。選択したテキストが特定の位置にあることを保証するには、選択したテキストをコマンドの末尾でその特定の位置に明示的に配置する必要があります。

Sub ActivePointExample()
   ' Before running this example, open a text document.
   Dim objSel As TextSelection = DTE.ActiveDocument.Selection
   Dim objActive As VirtualPoint = objSel.ActivePoint
   ' Collapse the selection to the beginning of the line.
   objSel.StartOfLine()
   ' objActive is "live", tied to the position of the actual selection, 
   ' so it will reflect the new position.
   Dim iCol As Long = objActive.DisplayColumn
   ' Move the selection to the end of the line.
   objSel.EndOfLine()

   MsgBox("The length of the insertion point line is " & (objActive.DisplayColumn - iCol) & " display characters.")
End Sub

アクセス許可

  • 直前の呼び出し元に対する完全な信頼。このメンバは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

参照

TextSelection インターフェイス

TextSelection メンバ

EnvDTE 名前空間