TextSelection.StartOfLine メソッド
更新 : 2007 年 11 月
オブジェクトを現在の行の先頭に移動します。
名前空間 : EnvDTE
アセンブリ : EnvDTE (EnvDTE.dll 内)
構文
'宣言
Sub StartOfLine ( _
Where As vsStartOfLineOptions, _
Extend As Boolean _
)
'使用
Dim instance As TextSelection
Dim Where As vsStartOfLineOptions
Dim Extend As Boolean
instance.StartOfLine(Where, Extend)
void StartOfLine(
vsStartOfLineOptions Where,
bool Extend
)
void StartOfLine(
[InAttribute] vsStartOfLineOptions Where,
[InAttribute] bool Extend
)
function StartOfLine(
Where : vsStartOfLineOptions,
Extend : boolean
)
パラメータ
Where
型 : EnvDTE.vsStartOfLineOptions省略可能です。行の開始位置を表す vsStartOfLineOptions 定数。
Extend
型 : System.Boolean省略可能です。移動したテキストの範囲選択を解除するかどうかを指定します。既定値は false です。
解説
Extend が True の場合は、選択したテキストのアクティブな終点だけがドキュメントの先頭に移動します。それ以外の場合は、選択したテキストは折りたたまれて移動します。
例
Sub StartOfLineExample()
' 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
アクセス許可
- 直前の呼び出し元に対する完全な信頼。このメンバは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。