Can you change the text color of ONLY the #region & #endregion keywords?

Verrouillé Can you change the text color of ONLY the #region & #endregion keywords?

  • dimanche 23 mars 2008 03:00
     
     

     

    Using Visual Studio 2008 (trial) and wanting to know how you can change the text color of ONLY the #region & #endregion keywords?

     

    I have looked through the Fonts and Colors menu option, but it looks like you can only change all Keywords to another color which is not what I am wanting. I only want to change the #region and #endregion keywords to make them stand apart. Currently I have so many they just blend in with the code. I know I could indent, but I would like to change the color to red or something else.

     

    VS is very customizable so I know there is a way to do this but cannot find an answer on the Internet.

     

    Any help is appreciated!

     

    Example of what I want:

     

    Code Snippet

    #region Public Methods

     

    public void Say(string speechString)

    {

    _isSpeaking = true;

    _voice.SpeakAsync(speechString);

    }

     

    public void Ask(string question)

    {

    _isAsking = true;

    Say(question);

    }

     

    #endregion Public Methods

     

     

Toutes les réponses

  • lundi 24 mars 2008 03:15
     
     Traitée

    I found the answer to my question.

     

    In Tools>Options>Environment>Fonts and Colors change the Preprocessor Keyword item to change the region text color.

     

    Hope this can help someone else who might want to know.
  • samedi 5 avril 2008 14:25
     
     
    This is very useful indeed! Thanks a lot!
  • mercredi 30 septembre 2009 16:45
     
     
    What about the text after #region (on the same line)? I'd like it to be green like a comment. I looked around for a bit but didn't see anything.

    Thanks.
  • mercredi 30 septembre 2009 17:54
    Modérateur
     
     
    You can only change the preprocessor keywords.  To get more advanced formatting you're going to have to look for third-party addons.  I use CodeRush from DevExpress (http://www.devexpress.com) and it can do what you want.  They have a free Express version available but I don't know if the region coloring is in the free version.

    Michael Taylor - 9/30/09
    http://p3net.mvps.org
  • mercredi 28 décembre 2011 02:44
     
     

    Excellent!

     

    Almost 4 years later this information is still helpful.

     

    Thanks!

  • jeudi 8 mars 2012 17:03
     
     
    Yes it is, thanks!