• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 181
  • Last Modified:

Printing ASC characters

I am trying to print some asc characters (box drawing shapes - codes 179 thru 223). If I use open "lpt1:" for output and print#1, (asciicode), I get the desired characters. I want to use the printer.print statement though. When I do this, I get a different set of characters for codes 128 thru 255. How can I use the printer.print statement to do this? I do not understand what is going on with the caharacter sets.  
0
dmoore2
Asked:
dmoore2
  • 2
1 Solution
 
mark2150Commented:
You simply do NOT draw this way in VB. This was a tried and true technique in QBASIC and DOS, but simply is NOT going to work in VB.

You can draw a box with:

Printer.Scale (0,0)-(8,10.5) '8-1/2x11 w 1/4" margins all round
Printer.Line (0,0)-(1,1), vbBlack, B

You set the .Scale property of your printer to the size of your page less a little bit for margin and then you can treat the printer like a plotter.

Position with .CurrentX/Y and use Printer.Print to put text down at that exact point (The text always prints down an to the right from the point specified).

For instance I can make graph paper with 1/4" grid with:

Printer.Scale (0,0)-(8,10.5) '8-1/2x11 w 1/4" margins all round

For X = 0 to 8 step .25
  Printer.Line (X, 0)-(X, 10.5) 'Draw verticals
Next X
'
For Y = 0 to 10.5 step .25
  Printer.Line (0, Y)-(8, Y) 'Draw horizontals
Next Y
'
Printer.EndDoc

Do not bother with "box drawing" characters. They won't lay out right with proportional fonts anyway.

M
0
 
dmoore2Author Commented:
Can the box be drawn first with with the text plotting code following?
0
 
mark2150Commented:
You can do it in any order you want. You can move up the page as well as down. Normally I print the outlines of the form and then come back in and overlay the data, but that's just me. You can print in any order you want.

M
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now