共用方式為


TextSelection.CharLeft 方法

將物件向左移動指定的字元數。

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

語法

'宣告
Sub CharLeft ( _
    Extend As Boolean, _
    Count As Integer _
)
void CharLeft(
    bool Extend,
    int Count
)
void CharLeft(
    [InAttribute] bool Extend, 
    [InAttribute] int Count
)
abstract CharLeft : 
        Extend:bool * 
        Count:int -> unit 
function CharLeft(
    Extend : boolean, 
    Count : int
)

參數

  • Extend
    型別:System.Boolean
    選擇項。判斷移動的文字是否折疊。預設值為 False。
  • Count
    型別:System.Int32
    選擇項。代表要向左移動的字元數。預設為 1。

備註

如果 Extend 為 True,則選取文字的作用端點會向左移動 Count 個字元。 否則,被選取文字將會被摺疊並且置於作用終點左邊 Count 所指定字元數的位置。

如果還沒有移動到 Count 指定的字元數就碰到了文件的開頭,則位置就會留在文件的開頭。 如果作用端點是在一行的開頭,則 CharLeft 會使它位於前一行的行尾。 也就是說,所有新行順序都會被視為單一字元。

如果 Count 是負數,則 CharLeft 的動作就會和 CharRight 相同。

範例

Sub ChangeLeftExample()
   ' 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 命名空間