TextSelection.CharRight 方法

将对象向右移动指定的字符数。

命名空间:  EnvDTE
程序集:  EnvDTE(在 EnvDTE.dll 中)

语法

声明
Sub CharRight ( _
    Extend As Boolean, _
    Count As Integer _
)
void CharRight(
    bool Extend,
    int Count
)
void CharRight(
    [InAttribute] bool Extend, 
    [InAttribute] int Count
)
abstract CharRight : 
        Extend:bool * 
        Count:int -> unit
function CharRight(
    Extend : boolean, 
    Count : int
)

参数

  • Extend
    类型:Boolean

    可选。 确定所移动的文本是否折叠。 默认值为 false。

  • Count
    类型:Int32

    可选。 表示右移的字符数。 默认值为 1。

备注

如果 Extend 是 true,则文本选项的活动的结束是移动的正确 Count 字符。 否则,文本选择在活动结束右侧折叠和定位 Count 字符。

如果在 Count 个字符之前到达文档结尾,则定位在文档结尾。 如果活动端在行尾,则 CharLeft 将其放在下一行的行首。 换言之,所有换行序列都被视为单个字符。

如果 Count 为负,则 CharRight 的作用效果类似于 CharLeft 方法。

示例

Sub CharRightExample()
   ' Open a document before running this example.
   Dim objSel As TextSelection = DTE.ActiveDocument.Selection
   objSel.StartOfDocument(True)
   objSel.StartOfLine(vsStartOfLineOptions.vsStartOfLineOptionsFirstText)
   objSel.CharRight(True, 4)
   objSel.ChangeCase(vsCaseOptions.vsCaseOptionsUppercase)
   MsgBox("Turned text uppercase.")
   objSel.CharLeft(False, 1)
   objSel.ChangeCase(vsCaseOptions.vsCaseOptionsLowercase)
   MsgBox("Turned text lowercase.")
End Sub

.NET Framework 安全性

请参阅

参考

TextSelection 接口

EnvDTE 命名空间