Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: VB
Expertise: Intermediate
Jul 11, 2006



Building the Right Environment to Support AI, Machine Learning and Deep Learning

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
Swaminathan Raghavan
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date