共用方式為


LanguagePreferences.EnableFormatSelection Property

Gets or sets whether or not code can be formatted.

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

Syntax

'宣告
Public Property EnableFormatSelection As Boolean
public bool EnableFormatSelection { get; set; }

Property Value

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