November 2014

Sun Mon Tue Wed Thu Fri Sat
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30            










« Companion apps now available in AutoCAD 2012 | Main | AutoCAD .NET Training DevTV Session 7: Jigs »

June 15, 2011

A guide-line for Visual Studio

And yes, I do mean that literally. :-)

Since starting this blog, 5 years ago – and even more in the last 2 years, since starting to develop and edit our Plugins of the Month for Autodesk Labs – I’ve been checking every line of code I’ve written to make sure it doesn’t exceed 70 characters in length (the magic number for fitting my blog’s width). It’s become close to automatic – in the sense I rarely write lines that exceed this length and therefore need adjusting – but the process I use is still quite manual: I check the status bar in Visual Studio to get the column count of the cursor position.

Augusto Gonçalves, from our DevTech team in Brazil, pointed out a nifty technique to add a guide-line (hence the post’s title) to Visual Studio at a certain column width. Here’s the Registry information (which can be saved to a .reg and merged with your Registry) that will do this for Visual Studio 2008:

Windows Registry Editor Version 5.00

 

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

"Guides"="RGB(128,0,0) 70"

Just changing the Registry information to 10.0 instead of 9.0 didn’t just make it work for Visual Studio 2010 on my system, despite information to the contrary on StackOverflow. But Daniel Du, from DevTech China, did point me to a handy Visual Studio extension (which comes in two parts and is described in this  blog post).

After installing the two extensions, it was possible for me to add a guideline at a particular column width by placing the cursor at the desired width, right-clicking and selecting “Add guideline”:

Adding a guideline

Which leads to our guideline being displayed (with the selected colour):

Our guideline in action

Interestingly, looking at the Registry the extension is actually modifying the entry that didn’t seem to have an effect when entered via the .reg file, so I assume there’s an additional entry I was missing. But anyway – the end result is what’s important, and this will save me a lot of effort. And hopefully some of you, too. :-)

blog comments powered by Disqus

Feed/Share

10 Random Posts