-
Nov 29th, 2021, 08:13 PM
#1
Thread Starter
Addicted Member
Printing a color
I am building a report with some items that are color coded. In each section of the report there is a line that has the word "color" that is to be followed by a short colored line or a small colored circle.
How is this done?
Thanks,
sneakers
Last edited by sneakers; Nov 29th, 2021 at 08:39 PM.
-
Nov 29th, 2021, 10:25 PM
#2
Hyperactive Member
Re: Printing a color
Originally Posted by sneakers
I am building a report with some items that are color coded.
You did not write in what format the report is created.
If the file is in .txt format, then color insertion is not possible.
If in .doc or .xls formats, then you can.
-
Nov 30th, 2021, 12:27 AM
#3
Re: Printing a color
And of course if you are using a reporting tool like Active Reports you can add color, shapes, images to your hearts desire.
-
Nov 30th, 2021, 12:44 AM
#4
Thread Starter
Addicted Member
Re: Printing a color
I'm just printing lines of text on my printer.
-
Nov 30th, 2021, 01:51 AM
#5
Re: Printing a color
Windows can provide a device context for a printer to draw into just as you would draw into the screen, though I can't say of the top of my head what the best way to do it in VB6 would be. I can't remember if the Printer object provides a device context. Anyways, you should be able to just set the foreground or text color of the device context and use an API like DrawText to draw coloured text then the printer could print whatever is in the device context.
-
Nov 30th, 2021, 03:12 AM
#6
Re: Printing a color
Originally Posted by sneakers
How is this done?
The following routine shows how:
Code:
Sub PrintTextAndCircleTo(oDest As Object, Text As String, Color)
oDest.Print Text & " ";
oDest.ForeColor = Color
oDest.Print ChrW(8226)
oDest.ForeColor = vbBlack
End Sub
It is up to you, what you pass as the first parameter (when Printing, it should be the VB6-Printer-Object) -
but below is an example, which uses the above routine on an empty Form:
Code:
Private Sub Form_Click()
Me.Font.Name = "Arial"
Me.Font.Size = 11
PrintTextAndCircleTo Me, "Color", vbRed
End Sub
HTH
Olaf
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|