Freigeben über


EditPoint.SmartFormat-Methode

Formatiert den angegebenen Textbereich entsprechend der aktuellen Sprache.

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

Syntax

'Declaration
Sub SmartFormat ( _
    Point As TextPoint _
)
void SmartFormat(
    TextPoint Point
)
void SmartFormat(
    [InAttribute] TextPoint^ Point
)
abstract SmartFormat : 
        Point:TextPoint -> unit
function SmartFormat(
    Point : TextPoint
)

Parameter

Hinweise

Intelligente Formatierung ist die automatische Formatierung von Code, die von der entsprechenden Programmiersprache ausgeführt wird. Der Bearbeitungspunkt und Point sind die Begrenzungen für die intelligente Formatierung. Sie können Optionen zur intelligenten Formatierung getrennt für jede Sprache im Menü Extras im Dialogfeld Optionen unter dem Knoten Text-Editor auswählen.

Die Neuformatierung umfasst die Zeilen mit den Endpunkten und berücksichtigt die globalen Einstellungen für den intelligenten Formatierungsstil (vsSmartFormatOptions).

Beispiele

Sub SmartFormatExample()
   Dim objTextDoc As TextDocument
   Dim objMovePt As EditPoint
   Dim objEditPt As EditPoint, iCtr As Integer

   ' Create a new text file.
   DTE.ItemOperations.NewFile("General\Text File")

   ' Get a handle to the new document and create an EditPoint.
   objTextDoc = DTE.ActiveDocument.Object("TextDocument")
   objMovePt = objTextDoc.EndPoint.CreateEditPoint
   objEditPt = objTextDoc.StartPoint.CreateEditPoint

   ' Insert ten lines of text.
   For iCtr = 1 To 10
      objEditPt.Insert("This is a test." & Chr(13))
   Next iCtr
   objEditPt.StartOfDocument()
   objMovePt.EndOfDocument()
   objEditPt.SmartFormat(objMovePt)
End Sub

.NET Framework-Sicherheit

Siehe auch

Referenz

EditPoint Schnittstelle

EnvDTE-Namespace