It was a bittersweet day when I learned that you can print to a file, using the Microsoft XPS Document Writer that appears in the list of installed printers in the Print dialog box. It was sweet because it made testing printing so much faster. But it was bitter because all my grand plans of buying a top-of-the-line color printer for my office became moot.
We all have to print at some point. So, when the time comes for you to print a file, it’s good to know what your options are in customizing how your printed pages look.
Sara Aside
Back in the Visual Studio .NET 2003 days, you had to go to File–Page Setup and check Line Numbers (in the lower left corner) to print line numbers, regardless of whether they were visible in the editor. For Visual Studio 2005 and beyond, we moved this option to the Print dialog box.
To print line numbers, go to File–Print, and on the lower left, you’ll see two options:
Here’s a bonus tip, because I cannot bring myself to write a "Did you know ... how to hide collapsed regions when printing" tip. It makes me yawn. You can also hide collapsed regions. I’ve used this when I wanted to print out just my test case function and I didn’t want to print out any of the helper functions because they all lived in the same test case file.
The preceding illustration, which I printed to an .xps file (no, I didn’t scan in a printed page), shows how the hidden collapsed regions will print out as ellipses.
I think we all, at one point in time, have tried to customize our editor colors or change keywords to bold or something else, and then pressed the Print button. Yet, we arrive at the printer confused that our changes haven’t been applied.
To customize your fonts and colors for printing, go to Tools–Options–Environment–Fonts And Colors and change the selection in the Show Settings For drop-down list to Printer. Now you can customize your fonts and colors, including bold.
Additionally, let’s say that you’ve already tweaked your colors or just want to use what you see in the editor. Then press the Use button and select Text Editor Settings. The default settings are restored to the original text editor defaults.
3.139.83.62