printer output

baddy
09-05-2000, 11:52 PM
I need some assistance regrading the following segment of code. Report is the common dialog box control.

Report.ShowPrinter
Report.PrinterDefault = True
Report.TrackDefault = True
Printer.Print listReport.Text
Printer.EndDoc

This code enables me to print out my text. But how do I set the margin of the output? I wish to add header and footer as well.

Phil
09-06-2000, 04:23 AM
Hi,
Printing from VB is a pain. To position text (or anything else) you must continually set the Printer.CurrentX and Printer.CurrentY properties. The units to use can be set by setting the Printer.Scalemode property. Therefore for your code to print the text at position 10mm from left and 10mm from top of page include

Printer.ScaleMode = 6
Printer.CurrentX = 10
Printer.CurrentY = 10
Printer.Print listReport.Text
Printer.EndDoc

This however prints 10mm x 10mm from the printable margins of the page which depends on the printer. To find these values you must use the Win32API function GetDeviceCaps which can be used to return all types of information about the printer not available from the printer object.

Hope this helps,
Phil

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum