Ok, I am trying to set up my VB 6.0 so that when I am printing my code to a color printer, I can quickly see my comment lines by having them print in the same color that my screen is showing the comment in. Is there any way to accomplish this?
I have tried to save it both as a .rtf format and also copy and paste into a .doc, but the comments still show up in black text both on the screen and on the print-out. You would think there would be an easy solution to this issue, but I am still scratching my head.
[tt]'This is a comment in green (I am using TGML for this site) If ThisWereAVariable = Black Then [/tt]
The first thing you would need to do is parse out your code file and load it into a RTB (RichTextBox). Then you would need to find or parse the text looking for specific symbols "'" or keywords (as above). Then once you have used the selstart and sellength properties to highlight the text you want to change color you set its color. Once this is done for the whole file you would save the file to disk then shell out word to print it.
I can also suggest that you search this site for "RTB" or "RichTextBox" you will find several solutions that will meet your needs.
For anybody who wants to build their own you can take the hints from my previous post disreguarding the saving the file and shelling out word and then use
This will print out the colors that you define for each character, word, line, etc. (and if you are using a B&W printer you will see shades of grey for some colors).
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.