Printing Color Lines in VB

Have you ever had a problem printing lines in color from VB6 (SP4)? The following code works correctly on a PictureBox, but prints black on the Printer (HP LaserJet and Lexmark):

    Object.ForeColor = vbRed    Object.Line (X1, Y1)-(X2, Y2)    ' red on PictureBox, black on Printer    Object.Print "Text"              ' ok on both PictureBox and Printer

The solution is to add the following color argument to your statement:

     Object.ForeColor = vbRed    Object.Line (X1, Y1)-(X2, Y2), vbRed  ' ok on both PictureBox and Printer    Object.Print "Text"                   ' ok on both PictureBox and Printer
Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: