English 中文(简体)
Visual Studio 2010 Beta 2: Can I print in color?
原标题:

I have to turn in a hard copy of some code with an assignment. Is there any way in Visual Studio 2010 to print C# source code with syntax highlighting?

PS: The assignment is solving a math problem, so the choice of language isn t important and the teacher doesn t need to compile and run the program. She just wants to see our approach and results.

最佳回答

If you go to Tools -> Options -> Environment -> Fonts and Colors you can change settings to print with syntax highlighting (change Show settings for dropdown to Printer ). But you will need to change all the individual settings to match your IDE (I don t know of a way to make it automatic)

Edit: you can use that "Use..." button next to the dropdown to copy settings from the Text Editor

问题回答

There is an extension now :) Visual Studio 2010 Color Printing Extension

Works well! :)

The best way I ve found to accomplish this is to copy from Visual Studio and paste into something like MS Word or OpenOffice Writer.

This gives you full source code, with syntax highlighting. You can then print from Word (including adding your intro documentation before the code, etc).

Just to let everyone know, unfortunately printing in color was cut from Visual Studio 2010 because of resource constraints. Since we ve rewritten the editor from scratch in WPF, we didn t have time to reimplement everything so we had to sacrifice this feature. We will try to implement this in the next version of Visual Studio. For now, copy to clipboard and paste into other app such as Microsoft Word is the recommended solution for printing code with color.

Simplest of all copy code to clipboard and paste into MS-Word is the way I do and it works...

Have a look at VS.NETcodePrint 2010 availabe from www.starprinttools.com. You will be able to print and export the color coded output to PDF.

Joginder Nahil

Due the fact MSVS does not support it anymore I think the best way is really to copy the code and paste it into WinWord. The advantages are listed below. You can

  • set the font/size exactly how you want it.
  • set the format of line numbers.
  • have your own header/footer.
  • remove #region from printing.
  • add a watermark to the output.

For me - I print once in 2 months a source code - it is a very comfortable way which I never could achieve with any 3rd party extension.





相关问题
building .net applications without Visual Studio

I m interested to hear about people working with building .net applications using MSBuild, NAnt or similar tools. What are you using, why are you using it instead of the VS IDE? I like to use ...

Tips for debugging a made-for-linux application on windows?

I m trying to find the source of a bug I have found in an open-source application. I have managed to get a build up and running on my Windows machine, but I m having trouble finding the spot in the ...

Visual Studio 2010 Beta 2: Can I print in color?

I have to turn in a hard copy of some code with an assignment. Is there any way in Visual Studio 2010 to print C# source code with syntax highlighting? PS: The assignment is solving a math problem, ...

Set Select command in code

On button Click I want to Set the Select command of a Gridview. I do this and then databind the grid but it doesn t work. What am i doing wrong? protected void bttnView_Click(object sender, ...

WPF design-time context menu

I am trying to create a custom wpf control, I m wondering how I can add some design-time features. I ve googled and can t seem to get to my goal. So here s my simple question, how can I add an entry ...

热门标签