Visual Basic 6 Black Book:Windows Common Dialogs
function GetCookie (name)
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen)
{
var j = i + alen;
if (document.cookie.substring(i, j) == arg) {
var end = document.cookie.indexOf (";", j);
if (end == -1)
end = document.cookie.length;
return unescape(document.cookie.substring(j, end));
}
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
var m1='';
var gifstr=GetCookie("UsrType");
if((gifstr!=0 ) && (gifstr!=null)) { m2=gifstr; }
document.write(m1+m2+m3);
Keyword
Title
Author
ISBN
Publisher
Imprint
Brief
Full
Advanced Search
Search Tips
Please Select
-----------
Components
Content Mgt
Certification
Databases
Enterprise Mgt
Fun/Games
Groupware
Hardware
IBM Redbooks
Intranet Dev
Middleware
Multimedia
Networks
OS
Prod Apps
Programming
Security
UI
Web Services
Webmaster
Y2K
-----------
New Titles
-----------
Free Archive
To access the contents, click the chapter and section titles.
Visual Basic 6 Black Book
(Publisher: The Coriolis Group)
Author(s): Steven Holzner
ISBN: 1576102831
Publication Date: 08/01/98
function isIE4()
{
return( navigator.appName.indexOf("Microsoft") != -1 && (navigator.appVersion.charAt(0)=='4') );
}
function bookMarkit()
{
var url="http://www.itknowledge.com/PSUser/EWBookMarks.html?url="+window.location+"&isbn=0";
parent.location.href=url;
//var win = window.open(url,"myitk");
//if(!isIE4())
// win.focus();
}
Search this book:
Previous
Table of Contents
Next
Setting Print Dialog Flags
You can set a number of options in the Common Dialog controls Flags property when working with the Print dialog box:
cdlPDAllPages&H0; returns or sets the state of the All Pages option button.
cdlPDCollate&H10; returns or sets the state of the Collate checkbox.
cdlPDDisablePrintToFile&H80000; disables the Print To File checkbox.
cdlPDHelpButton&H800; causes the dialog box to display the Help button.
cdlPDHidePrintToFile&H100000; hides the Print To File checkbox.
cdlPDNoPageNums&H8; disables the Pages option button and the associated edit control.
cdlPDNoSelection&H4; disables the Selection option button.
cdlPDNoWarning&H80; prevents a warning message from being displayed when there is no default printer.
cdlPDPageNums&H2; returns or sets the state of the Pages option button.
cdlPDPrintSetup&H40; causes the system to display the Print Setup dialog box rather than the Print dialog box.
cdlPDPrintToFile&H20; returns or sets the state of the Print To File checkbox.
cdlPDReturnDC&H100; returns a device context for the printer selection made in the dialog box. The device context is returned in the dialog boxs hDC property.
cdlPDReturnDefault&H400; returns the default printer name.
cdlPDReturnIC&H200; returns an information context for the printer selection made in the dialog box. An information context provides a fast way to get information about the device without creating a device context. The information context is returned in the dialog boxs hDC property.
cdlPDSelection&H1; returns or sets the state of the Selection option button. If neither cdlPDPageNums nor cdlPDSelection is specified, the All option button is in the selected state.
cdlPDUseDevModeCopies&H40000; if a printer driver doesnt support multiple copies, setting this flag disables the Number Of Copies control in the Print dialog box. If a driver does support multiple copies, setting this flag indicates that the dialog box stores the requested number of copies in the Copies property.
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 Print
When 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.
Figure 11.12 Setting print range in a Print dialog box.
TIP: If the user enters a number outside the allowed From and To range and clicks on OK, an error message box will appear letting them know what the allowed range is.
Setting Page Orientation
When 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:
cdlPortrait1; documents are printed with the top at the narrow side of the paper (the default).
cdlLandScape2; documents are printed with the top at the wide side of the paper.
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
Previous
Table of Contents
Next
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.
Wyszukiwarka
Podobne podstrony:
364 3652015 Kalendarz 365 pl365 Messianic Prophecies365 12365 ind365 367365 02368 czy pospolity grzyb moze byc przyczyna raka365 04więcej podobnych podstron