EditPoint2.CharLeft(Int32) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将编辑点左移指定的字符数。
void CharLeft(int Count = 1);
[System.Runtime.InteropServices.DispId(101)]
public void CharLeft (int Count = 1);
[<System.Runtime.InteropServices.DispId(101)>]
abstract member CharLeft : int -> unit
Public Sub CharLeft (Optional Count As Integer = 1)
参数
- Count
- Int32
可选。 向左移动的字符数。 默认值为 1 个字符。
实现
- 属性
示例
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
注解
CharLeft 将编辑点左移指定的字符数。 如果在指定的字符数之前到达文档的开头,则光标将保留在文档的开头。 如果编辑点位于行的开始处,则将 CharLeft 其置于上一行的末尾。 也就是说,所有换行符序列都作为单个字符处理。
如果的值 Count 为负,则 CharLeft 与方法的执行 CharRight 方式相同。