다음을 통해 공유


EditPoint2.Indent(TextPoint, Int32) Method

Definition

Indents the selected lines by the given number of indentation levels.

void Indent(EnvDTE::TextPoint const & Point = null, int Count = 1);
[System.Runtime.InteropServices.DispId(161)]
public void Indent (EnvDTE.TextPoint Point = default, int Count = 1);
[<System.Runtime.InteropServices.DispId(161)>]
abstract member Indent : EnvDTE.TextPoint * int -> unit
Public Sub Indent (Optional Point As TextPoint = Nothing, Optional Count As Integer = 1)

Parameters

Point
TextPoint

Optional. A TextPoint object endpoint for indentation. The default is the current line in the buffer, causing the current line in the buffer to be indented.

Count
Int32

Optional. The number of displayed columns to indent the lines. The default value is 1.

Implements

Attributes

Examples

Sub IndentExample()  
  ' Before running this example, open a text document.  
  Dim objTD As TextDocument  
  Dim objEP As EditPoint  

  objTD = DTE.ActiveDocument.Object("TextDocument")  
  objEP = objTD.StartPoint.CreateEditPoint  
  objEP.Indent(,5)  
End Sub  

Remarks

Indent indents the lines bounded by the edit point and Point, including the lines that contain the endpoints. Each line indents the given number of indentation levels. One indentation level is the number of display columns determined by the global editor's setting. Indent does not perform smart formatting or indent lines based on the context of the code. Smart formatting is auto-formatting of code done by the particular language. You can select smart formatting in each language node of the Options command on the Tools menu.

Tabs and spaces are inserted, depending on whether the global setting is set to use tabs when indenting. The indentation may consist of multiple tab and space characters, depending on the number of spaces a tab equals in the global setting.

If Count is negative, then Indent performs similarly to Unindent.

Indent fails if Count is greater than or equal to 10,000.

Applies to