EditPoint.Indent Method (TextPoint, Int32)

 

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

Namespace:   EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

void Indent(
	TextPoint Point = null,
	int Count = 1
)

Parameters

Point
Type: EnvDTE.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
Type: System.Int32

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

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.

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
Return to top
Show: