Oliver Hume
Oliver Hume

Reputation: 479

How to change the color of a #region in Visual Studio's 2008

I maybe going mad, but for the life of me I can't find the option to change the colour of collapsed region's in VS2008.

For example if I have the following code:

#region Test Region

CallSomeCode();

#endregion

If I now collapse that region it has the title "Test Region" in a grey text color with a grey box around it.

Upvotes: 16

Views: 9895

Answers (5)

KargWare
KargWare

Reputation: 2193

In Visual Studio 2022

In Menu: Tools → Options
In the Dialog: Environment → Fonts and Colors

Show settings for Text Editor and select in Display Item Preprocessor Keyword, choose your Item foreground and Item background color.

Options Dialog of Visual Studio 2022 - to define the color of the Preprocessor Keyword

Upvotes: 0

TxCsharper
TxCsharper

Reputation: 656

For those using VS 2015 that end up here, this is what worked for me in VS 2015:

#region and #endregion Keywords: Preprocessor Keyword [immediately applied]

Text After #region Keyword: Preprocessor Text [immediately applied]

Collapsed Region: Collapsed Text (Collapsed) [must restart Visual Studio]

A Picture

Upvotes: 15

userSteve
userSteve

Reputation: 1644

In VS 2012 the following worked for me:

  • To change color of #region / #endregion - set 'Preprocessor Keyword'
  • To change the text after #region when collapsed- set 'Collapsed Text (Collapsed)'
  • To change the text when expanded - set 'Plain Text', but beware this also changes ; ( [ etc

You may need to restart VS to take effect

Personally I wish there was two types of comments - one for disabling code, and one for explanatory remarks. They are two very different things but generally treated the same in most languages

Upvotes: 17

Dio Phung
Dio Phung

Reputation: 6282

in VS 2010, it is Tools→Options→Environment→Fonts and Colors→Code Snippet Field

Upvotes: 1

user151323
user151323

Reputation:

Tools→Options→Environment→Fonts and Colors→Display items[Collapsible text]

Upvotes: 22

Related Questions