Share via


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
    类型: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 命名空间