|
|
|
![]() | |
|
|
|
To access the contents, click the chapter and section titles.
Visual Basic 6 Black Book
Setting Print Dialog FlagsYou can set a number of options in the Common Dialog controls Flags property when working with the Print dialog box:
You can set more than one flag for a dialog box using the Or operator. For example: CommonDialog1.Flags = &H10& Or &H200& Adding the desired constant values produces the same result. Setting The Minimum And Maximum Pages To PrintWhen displaying a Print dialog box, you can set the minimum and maximum allowed values for the print range (in other words, the From and To pages to print) using the Min and Max properties of the Common Dialog control. The Min property sets the smallest number the user can specify in the From text box. The Max property sets the largest number the user can specify in the To text box. For example, here we restrict the possible pages to print to a maximum of 10, in the range 0 to 9:
Private Sub Command1_Click()
Dim intLoopIndex As Integer
On Error GoTo Cancel
CommonDialog1.PrinterDefault = True
CommonDialog1.Min = 0
CommonDialog1.Max = 9
CommonDialog1.ShowPrinter
For intLoopIndex = 1 To CommonDialog1.Copies
PrintForm
Next intLoopIndex
Cancel:
End Sub
Now when the Print dialog box appears, you can see that in the Print Range box, at lower left in Figure 11.12, one option button says All 10 Pages. That is, weve set a maximum total of 10 pages for our document. The actual page range is from 0 to 9.
Setting Page OrientationWhen printing, you can set the page orientationportrait (upright) or landscape (sideways)with the Common Dialog controls Orientation property. This setting is communicated to the printer automatically, but note that not all printers will be able to set a documents orientation. Here are the possible values for the Orientation property:
Heres an example. In this case, were setting the printers Orientation property to landscape:
Private Sub Command1_Click()
Dim intLoopIndex As Integer
On Error GoTo Cancel
CommonDialog1.PrinterDefault = True
CommonDialog1.Orientation = cdlLandscape
CommonDialog1.ShowPrinter
For intLoopIndex = 1 To CommonDialog1.Copies
PrintForm
Next intLoopIndex
Cancel:
End Sub
|
|
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. |