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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing Line Help!

Status
Not open for further replies.

jester18

Programmer
Joined
Jan 23, 2002
Messages
8
Location
GB
I am writing code to print a box but the printer just seems to print a blank sheet of paper.

Heres the code ive written.

Private Sub Command4_Click()
Dim prn As Printer
Set prn = Printer

startx1 = starty1 = 5670
endx1 = endy1 = 56700
black1 = RGB(0, 0, 0)

prn.Line (startx1, starty1)-(endx1, starty1), black1
prn.Line (endx1, starty1)-(endx1, endy1), black1
prn.Line (endx1, endy1)-(startx1, endy1), black1
prn.Line (startx1, endy1)-(startx1, starty1), black1

prn.EndDoc
End Sub

If anyone has any ideas they would be appreciated.

cheers.
 
A couple of points spring to mind.

1. Do you have a really big printer? The standard width of a printer is in Twips, which on a printer should be 1440 to the inch. Your endx and endy suggest a printer size of at least 40 inches.

2. You can't do multiple assignments in VB. Use:
startx1 = 5670
starty1 = 5670

Your statement:
startx1 = starty1 = 5670
first tests if starty1 = 5670 and then sets startx1 to true or false.

If you want to draw a simple box from VB try:

[tt]Printer.Line (500,500)-(10000,10000),,b
Printer.EndDoc[/tt]

where 500,500 is your start and 10000,10000 is your finish. The b parameter draws the box.

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
Thanks johnwm for your reply.

I didnt know you couldnt use multiple assignments.

Cheers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top