devxlogo

Printing Color Lines in VB

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
See also  How to Create and Deploy QR Codes Online: A Comprehensive Guide
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist