发表于:2002-11-28 16:38:00
1楼
Prints the specified window.
Syntax PrintWindow("Window",Left,Top,Width,Height,Options);
Parameters Description
Window The name of the window to print. Actual string or message tagname.
Left A floating point number whose units are inches to set the left margin. Number or real tagname.
Top A floating point number whose units are inches to set the top margin. Number or real tagname.
Width A floating point number whose units are inches that sets the width of the printout. This can be 0 to default to largest aspect ratio or can be a specific width. Number or real tagname.
Height A floating point number whose units are inches that set the height of the printout. This can be 0 to default to largest aspect ratio or can be a specific height. Number or real tagname.
Options A discrete value, 0 or 1, that is only used if Width and Height are 0. If Options is 1, the window is printed with the largest aspect ratio that is an integer multiple of the window size. Discrete number or discrete tagname.
If Options is 0, the window is printed with the largest aspect ratio that fits on the page.
Note
If the window contains a bitmap, set Options to 1 to prevent the bitmap from being stretched.
Remarks Many reports can be queued using this function. (It is recommended that PrintWindow() function be used in place of the PrintHT() function and user initiated prints from the Historical Trend runtime dialog box whenever the entire screen is to be printed, not just the trend chart.)
When this function is processed, View loads the window in an "off screen" memory area. View then waits 10 seconds to allow all of the DDE variables to be updated. The window is then sent to the printer. The window specified does not need to be open or visible to be printed. The amount of time View waits can be controlled by adding the following line to the INTOUCH.INI file:
PrintWindowWait=10000
10000 represents the number of milliseconds to wait.
Fonts are printed as fonts, objects are bit mapped and printed as such. Windows with white backgrounds that contain only fonts are printed very fast. Windows with colored backgrounds that contain many objects will take longer to print.
Note
To ensure that text in a window prints properly, it is recommended that "True Type" fonts be used for the text fields in all windows that will be printed.
When printing pushbuttons, the text on the button may appear "cut off" because the font used for the button text is the "System" font, which is not a "True Type" font. And, the "System" font in the printer is slightly different than the "System" font used on the screen. If this should occur, try expanding the button.
If the printer is being used to print alarms, a second printer is required to use the PrintWindow() function.
Examples
The following On True Condition Script prints a three page report every day at 8:30 AM:
Condition: $Hour == 8 AND $Minute == 30
Script Body: PrintWindow("1st Shift Summary",1,1,0,0,0);
PrintWindow("2nd Shift Summary",1,1,0,0,0);
PrintWindow("3rd Shift Summary",1,1,0,0,0);
The PrintWindow() function returns a 1 if the window name exists and could be queued to print. Otherwise, it returns 0. Therefore, status of the function can be monitored.
Status=PrintWindow("Shift Summary",1,1,0,0,0);
Status is a discrete tagname to which the 1 or 0 will be written.