We often preview before printing in order to control printing effects, especially in data printing, selectively print pages, more need to preview. PowerBuilder provides data print preview during program development, which is described below to implement print preview general methods in program applications. The main window is shown below: Print preview window Preview Size Custom 30% 50% 100% 200% Ruler 1 CB_2: Used to turn pages up to the data window. CB_3: Used to turn pages downwards in the data window. CB_4: Used to turn to the end of the data window. CB_5: Used to close the print preview data window. 2. Check Box Control (Checkbox) CBX_1: Used to add a display ruler for the preview data window. 3. Mask Editor Control (EditMask) EM_1: It is used to display and change the relative proportion of the print preview. 4. Setting the group box control (GroupBox) GB_1: Used to display a common attribute information of a set of controls. 5. Radiobutton RB_1: User-defined print preview ratio. RB_2: Used to set the print preview ratio of 30%. RB_3: Used to set the print preview ratio of 50%. RB_4: Used to set the print preview ratio of 100%. RB_5: Used to set the print preview ratio of 200%. 6. Data Window Control (DataWindow) DW_1: Used to display the printed preview result. Second, the following describes the implementation of the above window: 1. Create a new window w_preview, setting the type of the window (WindowType) to Response, set the title of the window (Title) is "Print Preview Window". 2. Place each control in the main window, define the properties for the mask editor (EM_1), define text to "100" in the General page, define "###" for Mask in the Mask page, select Spin Control, Set the spin increment to "1", set the min "1", MAX to "200". 3. Create Structure S_PREVIEW for the window, the specific step is: Tap Structure in the PowerBar toolbar, click the "New" button in the Select Structure dialog box, enter the structure definition window, in structure "DW_NAME" in the Variable Name, select "String" in the Structure Type (Type) to save this structure as the "S_PREVIEW". 4. Defined as a window w_preview Open event procedures are as follows: s_preview preview_parmpreview_parm = Message.Powerobjectparmdw_1.Dataobject = preview_parm.dw_namedw_1.Settransobject (SQLCA) dw_1.Objectwindow.Print.Preview = "yes" 5. Define two User Events (EM_1), and the second event name is user_change and user_room, the event user_change event identifies to PBM_ENCHANGE, which is triggered when the editor value changes, event user_room's event ID For PBM_CUSTOM01, it is triggered when the user calls the TriggeEvent () function, and the program is introduced below.