Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

black text appears in the shaded box?

Posted on 2002-04-08
7
Medium Priority
?
343 Views
Last Modified: 2012-06-27
How do you print a shaded rectangle (box) containing black text by using Printer object? I don't want any API! Any ideas?
0
Comment
Question by:computer1000
7 Comments
 

Author Comment

by:computer1000
ID: 6926490
I mean, how do I print the black text in the shaded box on the paper.
0
 
LVL 18

Expert Comment

by:Crash2100
ID: 6926565
You could do something like this:

Printer.DrawWidth = 5
Printer.Line (50, 50)-Step(1440, 1440), , B

Printer.CurrentX = 500
Printer.CurrentY = 500
Printer.FontSize = 20
Printer.FontBold = True
Printer.Print "test"
0
 

Author Comment

by:computer1000
ID: 6926574
Yes I could do something like that above. I use my code below.

'Printer.DrawWidth = 5
'Printer.FillColor = &H808080
'Printer.FillStyle = 0
'Printer.ForeColor = vbBlack
'Printer.FontTransparent = True
'Printer.Print ""
'Printer.Print "Hello this is a test"
'Printer.Line (0, 500)-(1400, 200), &HC0C0C0, B
'Printer.EndDoc

It does not show a shaded box here. What's wrong with my code?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 18

Expert Comment

by:Crash2100
ID: 6926611
What do you mean by it doesn't show a shaded box, it doesn't print anything?  If so, it may be outside your printer's minimum margins.  Try this and see if it works.


Printer.DrawWidth = 5
Printer.FillColor = &H808080
Printer.FillStyle = 0
Printer.ForeColor = vbBlack
Printer.Line (0, 0)-(5000, 5000), &HC0C0C0, B

'Change the current x and y locations to where
'you want to print the text
Printer.CurrentX = 1500
Printer.CurrentY = 2500

Printer.FontBold = True
Printer.Print "Hello this is a test"

Printer.EndDoc
0
 
LVL 5

Accepted Solution

by:
bob_online earned 600 total points
ID: 6927864
I assume that your code is not really all commented out...


swap these two lines and try it...

Printer.Line (0, 500)-(1400, 200), &HC0C0C0, B
Printer.Print "Hello this is a test"

My guess is that the box is covering the text (and no, the text would not show through because the box command is replacing the "pixels" of the text with the lighter color.

I haven't tried this and may be wrong, but I do know that this how the printer object behaves.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7643055
Hi computer1000,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept bob_online's comment(s) as an answer.

computer1000, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 1

Expert Comment

by:kodiakbear
ID: 7673280
Moving to the PAQ

kb
Experts Exchange Moderator
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question