I've discovered the Microsoft KB article (84269) that says that the ForeColor property of the Printer object "was not fully implemented" (and still isn't) and that the Windows API function call SetTextColor() must be used. I've used the following code in a new project as instructed by the article.
In Global Module (on one line):
Declare Function SetTextColor Lib "GDI" _
(ByVal hDC as Integer, ByVal crColor as Long) as Long
In Form1 Form_Click Event:
Sub Form_Click
For i = 0 to 15
x& = SetTextColor(Printer.hDC, QBColor(i))
Printer.Print "Hello"
Next i
Printer.EndDoc
End Sub
When I run the program and click the form I'm supposed to get the word "Hello" printed in 16 different colors. What I get is a Code 6 - Overflow error.
What's wrong? Also, are there any tools, techniques, etc. for printing in color via the Printer object? (I know I can use PrintForm but the material I'm printing exceeds the maximum vertical size of a QB form.
Thanks.
In Global Module (on one line):
Declare Function SetTextColor Lib "GDI" _
(ByVal hDC as Integer, ByVal crColor as Long) as Long
In Form1 Form_Click Event:
Sub Form_Click
For i = 0 to 15
x& = SetTextColor(Printer.hDC, QBColor(i))
Printer.Print "Hello"
Next i
Printer.EndDoc
End Sub
When I run the program and click the form I'm supposed to get the word "Hello" printed in 16 different colors. What I get is a Code 6 - Overflow error.
What's wrong? Also, are there any tools, techniques, etc. for printing in color via the Printer object? (I know I can use PrintForm but the material I'm printing exceeds the maximum vertical size of a QB form.
Thanks.