Guidelines – a hidden feature for the Visual Studio Editor

Update 12/2/2004:  Uploaded an image from Visual Studio 2005 Beta.  Note the image below shows guidelines at column numbers 5 and 30, but the regkey value is RBG(255,0,0), 4, 29.  The Guideline column numbers are 0-based in the registry.

Update 11/29/2004: I’ve corrected the two (embarrassing) typos below.  I must have had thanksgiving dinner on the brain at the time.  1.  The reg key is [HKEY_CURRENT_USER]\Software\Microsoft\VisualStudio\8.0\Text Editor (note the space between Text and Editor).  2. It’s RGB, not RBG.  The example had a typo, but it is now corrected.

Guidelines at columns 5 and 30

Guidelines are visible column indicators for the VS Editor. During the last test pass, I came across a test case named “Guidelines” which got my immediate attention. I never heard of this before, so I made sure to spend extra time testing this cool, but hidden little feature during the Beta test pass. I didn’t find any issues with it, so I feel it is safe to share. Let me know if you run into any issues with it.

Warning! To enable guidelines, you’ll need to modify your registry settings. Follow the instructions below at your own risk.

Enabling Guidelines

First, shut down Visual Studio 2005 if already started.


[HKEY_CURRENT_USER]\Software\Microsoft\VisualStudio\8.0\Text Editor

Create a string value called “Guides”

Set Guides to the following

RGB(x,y,z) n1,…,n13

Where x,y,z are the RGB values and n is the column number. You can have at most 13 guidelines.

For example,

Guides = RGB(128,0,0) 5, 80

will place a Red guideline at column numbers 5 and 80.

And now launch VS and open a text file.

Disabling Guidelines

An obvious no-brainer, just delete the Guides keys you created above. Restart VS, and no more guidelines.

Comments (76)

  1. Uwe Keim says:

    For which version of VS.NET does this apply? 2002? 2003? 2005?

  2. Uwe Keim says:

    Oh, just read… shame on me, sorry :-)

  3. sara ford says:

    It will work on Visual Studio .NET 2003 and should work on Visual Studio .NET 2002, but use at your own risk on either. I tested that it does work on 2003, but very little, so i can’t ensure product stability using guidelines there. And i have *not* tested it at all on 2002, but the notes i have say it should work there.

    If you encounter an issue on any version, let me know.


  4. Guidelines? Brilliant!

    I’ve often thought that such a feature would be nice to have, happily some dev at the VS team thought about that too. I’ll let you know when/if it crashes 😉 (I’m using VS2003 btw.)

  5. Black Fox says:

    Nice timing , i was searching it recently…

    Thanks a lot

  6. Carl Daniel [VC++ MVP] says:

    Just the sort of thing to go into "VS PowerToys"… (where’d I see that idea kicked around…?)

  7. Steven Cohn says:

    Seems to work OK, but I can’t seem to alter the color. Regardless of RGB values, it always draws a black dotted line.

  8. BillT says:

    Note the typo:

    Guides = RBG(128,0,0) 5, 80

    should be RGB, I assume.

  9. Alain says:

    On Visual Studio 2003, you should use

    [HKEY_CURRENT_USER]SoftwareMicrosoftVisualStudio7.1Text Editor

    Guides=RGB(192, 192, 192) 80

    Be care about the space between Text and Editor !


  10. Jasper22 says:


    No effect on my Visual Studio 2003

  11. RegEdit:


    Edit > New > String Value: Guides

    Edit > Modify > Value Data: RGB(254,252,252) 4

    Results in no change for either VS2003 or VS2005.

    Modified Value Data As: =RGB(254,252,252) 4 does not produce results either.

    Ironically, just this morning before reading this blog item I sent a suggestion to MSDN Feedback Center asking for the addition of ‘status’ when backspacing to prevent the annoying backspace to previous line which happens when backspacing past the 0th column which I am too blind to see perceptively.

    Guidelines would do I suppose but again, they do not function for me and I believe I have modified the registry correctly as shown above. Please advise.

  12. Jože Marinček says:

    Depends also on background – using default white (default on my system), RGB(255,252,252) will produce white guidelnes on white background – not much to see there, except through selection :-)

    Change the colour.

  13. Harry Bosch says:

    Works nicely on VS2003, but not heavily tested yet. One suggestion (which may not apply with VS2005): The guide line shows up in the Output window too, which I find distracting. I’d like it to show up in my documents only, I don’t want them in the Output window.

  14. RichB says:

    Works OK for me in VS2003 – however I have no idea what use they’d be.

    Sara – What does the Guidelines spec say is the intended usage scenario?

  15. Alain says:


    I will use this feature to prevent me when I write more than 100 char in one line.

    My source will be more readable and printable.

  16. sara ford says:

    Hi Clinton,

    RGB(255, 252, 252) shows a white guideline. If you go to Tools Options – Fonts and Colors – Text Editor, and change the Text background to black, you’ll see the white guideline.



  17. zeddock says:

    May I suggest that someone should post a screenshot for this?



  18. sara ford says:

    Yep, that can be arranged. I’ll update the post with a picture.

  19. Mike Dunn says:

    Nice. It works fine in VC 7.1 for me. I had been using the Visual Assist guideline feature, but that has funny redraw problems when you scroll w/the wheel. This built-in one looks better.

  20. sara ford says:

    Post updated with image. Thanks!

  21. Kenny says:

    As a user of several editors that expose an equivalent feature, the definition of the column numbers actually seems quite intuitive to me. The position of the guide is usually defined as being displayed *after* the specified column. Defining "4 29" in your example would create guides after column 4 and after column 29, which is exactly what your screenshot shows.

    This is a feature that I’ve always missed in Visual Studio. I was especially happy to see that it also works in VS 2003, although I agree that it would be nice to have it only in the source code windows and not in the output window.

  22. sara ford says:

    I couldn’t agree more with just having the guidelines show in the source code, and not in the command window, output window, etc (any tool window that contains an VsTextView editor).

    I’m recording all these suggestions, comments and feedback for the next version.

  23. baris's blog says:

    Guidelines – a hidden feature for the Visual Studio Editor An obvious no-brainer, just delete the Guides keys you created above. Restart VS, and no more guidelines….

  24. Tom Seddon says:

    The text needs to be drawn on top of the guidelines rather than the other way around. Particularly distracting if you have guidelines that are closer to the background colour than the text colour.

    This doesn’t affect all fonts; only those that are flush with the left edge of their bounding box as far as I can tell. (I have a couple of bitmap fonts that are like this, having the spare column on the right- rather than the left-hand edge.)

  25. Tom Seddon says:

    Sorry, should add:

    1. Obviously the feature works for me (VS.NET 2002);

    2. I noticed the ‘lines on top of text’ because I was trying out having guidelines at each tab stop. It would be handy for future revisions of the editor to not necessarily draw text on guidelines but perhaps when programming in languages that have curly braces draw a vertical line to the corresponding matching curly brace when the cursor is on a curly brace. The editor "scite" does this, and it’s dead handy.

  26. Thomas Due says:

    It actually works in VS 2003 too.

  27. Many thanks to Craig for pointing out thsi very useful (hidden) feature of Visual Studio:


  28. Now here is a feature that we should expose far more prominently (and I’ll push the core team to do so)…

  29. Now here is a feature that we should expose far more prominently (and I’ll push the core team to do so)…

  30. Nate's Blog says:

    I just happened to stumble onto this

    useful piece of information today. There is a hidden guidline feature

    in Visual Studio 2003. This isn’t all that important to most people

    anymore since code is rarely edited on a 80 column display but it is a


  31. Opher says:

    Well, I’ve read the post, the updates and the comments. No one has suggested the obvious: This is good so make it official! Put it in the product, as an Option, with a real UI and a dialog box (maybe even a PREVIEW?) that will be documented, supported, etc. I suspect no one reading these blogs is timid about editing the registry, but how about "casual" programmers? How about the VS Express products – does this "hidden feature" work? Wouldn’t the whole VS product line be "better" with guidelines as a ‘feature’ rather than a ‘hack’?

  32. Tanveer says:

    I am using VS 6.0 and want to add Guidlines in it. I am not able to do so.

  33. mrk says:

    A command to toggle the display of guidelines in the text editor could be useful too, bind it to a key to view when you want guidance.

  34. Tobias says:

    Thanks a lot! Those guidelines work perfectly within Visual C++ 2005 Express Edition August CTP, too. You just have to create a string value called Guides (using the information above) not under

    [HKEY_CURRENT_USER]SoftwareMicrosoftVisualStudio8.0Text Editor

    but under

    [HKEY_CURRENT_USER]SoftwareMicrosoftVCExpress8.0Text Editor

    Hopefully there will be a straightforward configuration option in later versions of VS rather than modifying the registry manually.

  35. Chris Christodoulou says:

    Very useful feature! The first thing I tried to do was make guidelines of different colors:

    [HKEY_CURRENT_USERSOFTWAREMicrosoftVisualStudio8.0Text Editor]

    "Guides"="RGB(200,200,255) 2,RGB(255,200,200) 4"

    but VS only used the last color. It would be rather cool if multiple color guides were supported so when many guides are shown one wouldn’t have to count them to find the right spot. Other than that, good stuff!



  36. John Cui says:

    Yes, this is a very good feature, and I would more like a underline for currentline in editor, does it possible?

  37. Gorky says:

    Quick tip if it’s not working:

    Make sure you set the registry value for *HKEY_CURRENT_USER* not HKEY_LOCAL_MACHINE which is what I tried at first and couldn’t get it to work.  I typically head to local machine in the registry out of habit.

  38. bill says:

    if you find it difficult to find some text editors , go , this is an excellent text editor.

  39. Troy Scheffel says:

    Thanks for the tip; works great (in VS2005 at least, I haven’t tried it for VS.Net and hopefuly won’t need to).  I’ve longed for this simple feature in VS.Net/2005.  All other good code editors I’ve used over the years had this feature.

    Someone asked why you’d want this feature.  I use two lines, one set at column 77 which is where I start most line comments and one set at column 120 which indicates where no text should extend beyond (to prevent line wrapping during printing).  Thus, my Guides value is "RGB(255,0,0) 76, 119" (255 = dark red).


  40. Любой профессиональный текстовый редактор умеет показывать правую границу "полей" (Right Margin). Встроенный…

  41. Mythran says:

    Is there another hack to perform the same thing, but horizontally?  How about having multiple guidelines with different colors for each?

  42. Giuseppe Turitto says:

    Thank You very much this is the most handy trick, Actually I tested for SQLmanager and works beautifull.

    [HKEY_CURRENT_USER]/Software/Microsoft/Microsoft SQL Server/90/Tools/Shell/Text Editor/

    and from there create the Guides String value, and everything its the same.

  43. JDang says:

    Very cool, thanks a lot guys. However, it also show the line in Command and Output windows of Visual studio 2005. Are there any way to turn it off. I just want the line in Codes window only.


  44. Nihgwu says:


  45. A nice feature to verify coding styles: Guidelines . Missed this one in the previous VStudio.

  46. Arvind says:

    This question was once asked before in the forum but nover got answered. Is it possible to get these guidelines working for Visual Studio 6.0? If not natively supported is there any add-in available that will do the job. ~ Arvind

  47. ploeh blog says:

    From time to time, I’ve found myself wishing that Visual Studio had vertical guidelines in the code editor.

  48. Adding Guides to Visual Studio

  49. thyking xiao says:

    在 2005 编辑器中设置一条代码边界线,以防止自己的代码行写的过长。

  50. It’s a necessary evil in my line of work, but as a software developer I reliably screw up my development