
Visual studio change curly brace style(highlight braces background) and display it on new line
When you click in front of the braces(brackets), Visual Studio will automatically add a background to them to identify a pair of brackets, so that we can identify the scope of code. However, the default background color of Visual Studio braces is usually lighter(especially for highlight monitors), and there is no background color at all, which requires a darker color.
In terms of the background color of brackets in Visual Studio, it refers to all brackets(curly brackets {}, brackets (), square brackets []) as bracket matching(Rectangle), as long as the background color of square brackets(or Brace Matching) is set, the background color of all brackets is set, see the setting method below.
I. Visual studio change curly brace style(highlight braces background)
1. Quick settings
"Tools" menu → Options → Environment → Fonts and Colors → Select "Brace Matching or Brace Matching(Rectangle)" under "Display items" → select a "Background Color" → OK → Finish.
2. Detailed steps
1. Select the "Tools" menu → Options in turn, and open the dialog box as shown in Figure 1:
Figure 1
2. Expand "Environment", select "Fonts and Colors", select "Brace Matching or Brace Matching(Rectangle)" under "Display items", as shown in Figure 1.
3. Select a " background color", such as "Lime", there is a preview under the "Sample", you can change a color if you don't like it.
4. Click "OK". After a while, the setting will take effect. Click in front of the braces. The "Lime" background color has been displayed, as shown in Figure 2:
Figure 2
5. Clicking before the brackets also shows the "Lime" background, as shown in Figure 3:
Figure 3
Clicking the square brackets will also display a "Lime" background, don't put the picture. You can open the Visual Studio setting experience yourself.
II. Visual studio braces on new line
1. Click "Tools", select "Options" in the pop-up menu, open the "Options" dialog box, select "Text Editor" → C# → Code Style → Formatting → New Lines, check the "Place open brace on new line for types", as shown in Figure 4:
Figure 4
2. In the preview box below, the braces have been displayed on the new line. In addition to "Place open brace on new line for types", there are multiple options, you can preview one by one, check the desired.
In addition to placing braces in different positions, keywords(such as esle, catch, and finally) can also be used, for example, display esle to a new line, as shown in Figure 5:
Figure 5
-
Related Reading
- C# Read and write to text file Newline, with one lin
- C# Winform button transparent background with proper
- Bubble sort algorithm example in C# and C (Ascending
- C# if else vs switch, which efficiency is high(multi
- C# label control, with winforms label transparent ba
- C# Richtextbox change font color, add and foreach li
- C# Winforms textbox focus(2 methods)
- C# Winform mouse cursor style setting method
- C# sort files or folders by name, date and creation
- Change Visual Studio default encoding and how to dis
- Three methods of Hashtable sort by key or value in C
- C# Windows Forms foreach controls, with Textbox and