Tuesday, April 24, 2012

How Can I Print in Color in Visual Studio?


One issue that came up in class some time back was that a student was printing his code from Visual Studio when he noticed that all of his code was being printed in black and white. From a learning perspective, he sometimes likes to view his code on paper, mark it up by hand, draw arrows and in other ways interact with it and make it sense of it.

However, one of the helpful features of Visual Studio, of course, (and of most Integrated Development Environments) is the color coding. By default, comments are shown in green, strings of text in red, keywords in dark blue and so on. So the student wanted to see if there was any way to get Visual Studio to print the code using the color coding that shows up onscreen.

It turns out that in Visual Studio 2008 and 2010, the color coding isn't enabled for print-outs. However, there is an extension from Microsoft that can be loaded to enable it to print in color.

The upside is being able to print in color.

The downsides are:
1)      The extensions are not supported in the Express versions of the Visual Studio products, and so Microsoft's color printing extension cannot be loaded on those versions.
2)      Collapsible regions will be printed as expanded; they cannot be skipped from the printout.
3)      The new print dialog box doesn't enable printing line numbers, and so they can only be printed by enabling line number margins in Tools-->Options.
4)      Margins for the page itself cannot be altered in this version.

To review the documentation and/or install the Color Printing extension for Visual Studio, visit: http://visualstudiogallery.msdn.microsoft.com/00ec88c2-1553-47d2-8170-3c5baa0c6e44/?SRC=Home

1 comment:

  1. You can copy all and paste into Word and print that out. The printout will be in color. Kind of a pain, but it gets you the nice color printout without having to get the paid version of VS.

    ReplyDelete