Guidelines in Visual Studio 2002, 2003 and 2005 text editors (Thanks to Channel 9 and Sara Ford)
Guidelines in Visual Studio 2002, 2003 and 2005 text editors (Thanks to Channel 9 and Sara Ford): "ver since I fired up Netbeans for the first time I have wanted the 80 column guideline it has in the text editor window. Sure, there’s a control at the bottom of the text editor window that tells you where your cursor is column wise but honestly, a faint line right up column 80 works best.
Of course not everyone likes doing this but I’ve found that my code is the most readable visually and printed if I force breaks at 80 columns, or perhaps 120 columns. Now, thanks to a Channel 9 post here and the original post by Sara Ford here I now know how to add guidelines in Visual Studio. Why this isn’t an option in Tools… Options is beyond me. Apparently it has been a hack for the past several versions.
Here’s how you do it. Close Visual Studio and open up regedit. Navigate to the key below inserting the version number of your VS install where appropriate (ie. for Visual Studio 2005 you’ll find an “8.0” key under the VisualStudio branch).
[HKEY_CURRENT_USER]\Software\Microsoft\VisualStudio\Text Editor
Now, create a new REG_SZ (String) value named “Guides” under the Text Editor branch.
Next, double click the new Guides key and insert the following text as its string value.
RGB(R,G,B) c1, c2… cn
where R, G, and B are the RGB values for the color you want the guideline to be. Mine is set to 255,128,128 which gives you a faint red line that almost appears semi-transparent. The values c1… cn are the column numbers you want guides to appear at. NOTE: the column values you set in the registry are 0 (ZERO) based. IOW, if you want guides at column 80 you’ll need to set it at 79. You can have guidelines at as many columns you like, thus the cn. :-) Mine is set to 79, 119 because I want guide lines at 80 columns and 120 columns.
To bring it all together mine says.
RGB(255,128,128) 79, 119
I’ve attached a couple of images below to help visualize the whole process. Click the image for a larger view.
Screen shot of registry location and string value to insert.
Regedit of Guides at 80 columns
Screen shot of the 80 column guideline (VS2005).
Guidelines at 80 columns"
Of course not everyone likes doing this but I’ve found that my code is the most readable visually and printed if I force breaks at 80 columns, or perhaps 120 columns. Now, thanks to a Channel 9 post here and the original post by Sara Ford here I now know how to add guidelines in Visual Studio. Why this isn’t an option in Tools… Options is beyond me. Apparently it has been a hack for the past several versions.
Here’s how you do it. Close Visual Studio and open up regedit. Navigate to the key below inserting the version number of your VS install where appropriate (ie. for Visual Studio 2005 you’ll find an “8.0” key under the VisualStudio branch).
[HKEY_CURRENT_USER]\Software\Microsoft\VisualStudio\Text Editor
Now, create a new REG_SZ (String) value named “Guides” under the Text Editor branch.
Next, double click the new Guides key and insert the following text as its string value.
RGB(R,G,B) c1, c2… cn
where R, G, and B are the RGB values for the color you want the guideline to be. Mine is set to 255,128,128 which gives you a faint red line that almost appears semi-transparent. The values c1… cn are the column numbers you want guides to appear at. NOTE: the column values you set in the registry are 0 (ZERO) based. IOW, if you want guides at column 80 you’ll need to set it at 79. You can have guidelines at as many columns you like, thus the cn. :-) Mine is set to 79, 119 because I want guide lines at 80 columns and 120 columns.
To bring it all together mine says.
RGB(255,128,128) 79, 119
I’ve attached a couple of images below to help visualize the whole process. Click the image for a larger view.
Screen shot of registry location and string value to insert.
Regedit of Guides at 80 columns
Screen shot of the 80 column guideline (VS2005).
Guidelines at 80 columns"