TextSelection.AnchorPoint プロパティ
更新 : 2007 年 11 月
選択範囲の起点を取得します。
名前空間 : EnvDTE
アセンブリ : EnvDTE (EnvDTE.dll 内)
構文
'宣言
ReadOnly Property AnchorPoint As VirtualPoint
'使用
Dim instance As TextSelection
Dim value As VirtualPoint
value = instance.AnchorPoint
VirtualPoint AnchorPoint { get; }
property VirtualPoint^ AnchorPoint {
VirtualPoint^ get ();
}
function get AnchorPoint () : VirtualPoint
プロパティ値
VirtualPoint オブジェクト。
解説
TextPoint オブジェクトは、エディタ ウィンドウで選択したテキストの位置を示しますが、バッファの位置をマークするわけではありません。行末を越えた領域である仮想空間も、エディタ ウィンドウ内でのみ追跡されます。したがって、テキスト バッファで EditPoint を使用してテキストを変更したときに、選択したテキストに対して何が起こるかは定義されていません。たとえば、選択したテキストで開始し、エディット ポイントを取得して、バッファを変更するコマンドがあるとします。選択したテキストが特定の位置にあることを保証するには、選択したテキストをコマンドの末尾でその特定の位置に明示的に配置する必要があります。
例
Sub AnchorPointExample()
' Before running this example, open a text document.
Dim objSel As TextSelection = DTE.ActiveDocument.Selection
Dim objAnchor As VirtualPoint = objSel.AnchorPoint
' objAnchor is "live", tied to the position of the actual selection,
' so it will reflect any changes. iCol and iRow are created here to
' save a "snapshot" of the anchor point's position at this time.
Dim iCol As Long = objAnchor.DisplayColumn
Dim iRow As Long = objAnchor.Line
' As the selection is extended, the active point moves but the anchor
' point remains in place.
objSel.StartOfDocument(True)
objSel.EndOfDocument(True)
If (iCol = objAnchor.DisplayColumn And iRow = objAnchor.Line) Then
MsgBox("The anchor point has remained in place at row " & iRow & ", display column " & iCol)
End If
End Sub
アクセス許可
- 直前の呼び出し元に対する完全な信頼。このメンバは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。