Search Tools Links Login

GBIC: Printing


Visual Basic 6, or VB Classic

The following is reprinted for archival purposes from Gary Beene's Information Center, with permission from Mr. Beene himself.


'VB allows printing to 3 objects within a program
'1. Printer
'2. Picture controls
'3. Forms

Printer. Print "hello"
picture1. Print "hello"
form1. Print "hello"

'printer/picture/forms support key properties which affect where the printing
'takes place and how it look
.CurrentX 'starting X position
.CurrentY 'starting Y position
.ScaleMode 'values are twips, points, pixels, inches, cm, mm, character
.ScaleLeft 'coordinate at left of object
.ScaleTop 'coordinate at top of object
.ScaleWidth 'width of object
.ScaleHeight 'height of object

'Printing starts at x,y coordinates 0,0, or whereever set with .CurrentX and .CurrentY properties
Printer.CurrentX = 1000
Printer.CurrentY = 3000

'Exact set of properties available depends on the printer driver supplied by the printer manufacturer

'To end printing on a page and start a new page use (does not apply to forms/pictures)
Printer.NewPage

'To end printing on a document and eject the page use (does not apply to forms/pictures)
'VB automatically calls this when a program ends, if there is content in the print buffer
Printer.EndDoc

'VB supples a special method to print the entire content of a form
form1.printform

'When within the IDE, printing can also be in these two locations, but with no positioning control
'Debug window
'Immediate window

About this post

Posted: 2021-02-11
By: ArchiveBot
Viewed: 167 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.