TextSelection.SmartFormat 方法

定义

根据当前语言格式化选定行的文本。Formats the selected lines of text based on the current language.

public:
 void SmartFormat();
public:
 void SmartFormat();
void SmartFormat();
[System.Runtime.InteropServices.DispId(46)]
public void SmartFormat ();
[<System.Runtime.InteropServices.DispId(46)>]
abstract member SmartFormat : unit -> unit
Public Sub SmartFormat ()
属性

示例

Sub SmartFormatExample()  
   ' Before running this example, open a code document.  
   Dim objSel As TextSelection = DTE.ActiveDocument.Selection  
   ' Select all code in open document.  
   objSel.SelectAll()  
   ' Apply smart formatting rules for the language.  
   objSel.SmartFormat()  
End Sub  

注解

根据智能缩进的全局设置,重新缩进或设置文本选择的格式,包括定位点和活动端的行。Re-indents or formats the text selection, including the lines the anchor and active ends are on, according to global settings for smart indenting. SmartFormat 使选定内容在末尾包含完整的行。SmartFormat causes the selection to include the complete lines at the ends.

适用于