共用方式為


LanguagePreferences.EnableFormatSelection Property

Gets or sets whether or not code can be formatted.

Namespace:  Microsoft.VisualStudio.Package
Assemblies:   Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.12.0 (in Microsoft.VisualStudio.Package.LanguageService.12.0.dll)
  Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
  Microsoft.VisualStudio.Package.LanguageService.11.0 (in Microsoft.VisualStudio.Package.LanguageService.11.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)

Syntax

'Declaration
Public Property EnableFormatSelection As Boolean
public bool EnableFormatSelection { get; set; }
public:
property bool EnableFormatSelection {
    bool get ();
    void set (bool value);
}
member EnableFormatSelection : bool with get, set
function get EnableFormatSelection () : boolean 
function set EnableFormatSelection (value : boolean)

Property Value

Type: Boolean
true if the code can be formatted, otherwise false = no automatic formatting.

Remarks

This property applies to both selected and unselected text. The code can be formatted when the user selects the command Format Document or Format Selection. Code can also be formatted as part of code snippet expansion or triggered dynamically as the user types certain characters.

This property is associated with the registry entry EnableFormatSelection.

In the base method, even though this property can be set, the value is not written back to the registry.

.NET Framework Security

See Also

Reference

LanguagePreferences Class

Microsoft.VisualStudio.Package Namespace