Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printer Object - Background Color

Status
Not open for further replies.

TOMBUGGY

Programmer
Oct 4, 2000
36
US
I use the Printer Object (Printer.Print) to print a golf scorecard. I would like to highlight the score boxes for selected holes with a background color.

I fill the score boxes for holes with either blank characters or a combination of blank characters and asterisk characters for handicap strokes (for example, " *" for a single handicap stroke on a hole). With the Printer Object the background color does not get printed when the character to be printed is a blank.

Is there a solution to this situation? Thanks.

 
I would take a look at the Data Report designer for this.

Beir bua agus beannacht!
 
I've created a VB form of the scorecard using Labels for for the score entry boxes. This allows me within my code to set the BackColor of the Labels for a given hole to vbYellow for highlighting.

Solution? Not quite. Even though I've used the smallest FontSize (8) for the information on the form and squeezed things, when the form is printed via .PrintForm it's two+ inches too wide for an 8-1/2 x 11 page and one inch too high to permit two scorecards on a page.

Is there a way to "scale" the printed output of the form? Thanks.
 
Using PrintForm is not a good solution. Quality is a problem and scaling is a problem.

Going back to the Printer object maybe you should consider something like this;

Option Explicit
Private Sub Command1_Click()

Dim pdev As Object
Set pdev = Me 'change this to 'Set pdev = Printer' to print on the printer
pdev.ScaleMode = vbCentimeters
PrintTextInABox pdev, "Hello world", 2, 2, vbYellow, vbBlack

End Sub

Sub PrintTextInABox(pdev As Object, MyText As String, x As Single, y As Single, BoxColor As Long, TextColor As Long)

pdev.ForeColor = BoxColor
pdev.Line (x, y)-(x + pdev.TextWidth(MyText), y + pdev.TextHeight(MyText)), BoxColor, BF
pdev.ForeColor = TextColor
pdev.CurrentX = x
pdev.CurrentY = y
pdev.Print MyText

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top