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
    类型:System.Boolean
    可选。确定所移动的文本是否折叠。默认值为 false。
  • Count
    类型:System.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 命名空间