EditPoint.CharLeft 方法

將編輯點向左移動指定的字元數目。

命名空間:  EnvDTE
組件:  EnvDTE (在 EnvDTE.dll 中)

語法

'宣告
Sub CharLeft ( _
    Count As Integer _
)
void CharLeft(
    int Count
)
void CharLeft(
    [InAttribute] int Count
)
abstract CharLeft : 
        Count:int -> unit 
function CharLeft(
    Count : int
)

參數

  • Count
    型別:System.Int32
    選擇項。要向左移動多少個字元。預設值是 1 個字元。

備註

CharLeft 將編輯點向左移動指定的字元數目。 如果還沒移動到指定的字元數目就已經到了文件的開頭,則游標會停留在文件的開頭。 如果編輯點是在一行的開頭,則 CharLeft 會將其保留於前一行的結尾。 也就是說,所有新行順序都會被視為單一字元。

如果 Count 的值是負數,則 CharLeft 會以與 CharRight 方法相同的方法來執行。

範例

Sub CharLeftExample()
   Dim objTextDoc As TextDocument
   Dim objEditPt As EditPoint, iCtr As Integer
        
   ' Create a new text file.
   DTE.ItemOperations.NewFile("General\Text File")
        
   ' Get a handle to the new document and create an EditPoint.
   objTextDoc = DTE.ActiveDocument.Object("TextDocument")
   objEditPt = objTextDoc.StartPoint.CreateEditPoint
        
   ' Insert ten lines of text.
   For iCtr = 1 To 10
      objeditpt.Insert("This is a test." & Chr(13))
   Next iCtr
        
   ' Change the first letter of the fourth word of the fourth line.
   objEditPt.StartOfDocument()
   objEditPt.LineDown(3)
   objEditPt.WordRight(3)
   objEditPt.CharRight(2)
   objEditPt.CharLeft(2)
   objeditpt.Delete(1)
   objEditPt.Insert("p")
End Sub

.NET Framework 安全性

請參閱

參考

EditPoint 介面

EnvDTE 命名空間