PageSetupDialog PrintDialog PrintPreviewDialog SaveFileDialog

213 • If a given item has multiple filters, the filters are separated by semicolons ; . The second item in the list in Figur e 5- 17 is therefore represented by: Executable Files .exe; .dll|.exe;.dll • The value to assign to the Filter property is the concatenation of all the substrings thus attained, again separated by the vertical bar character. Therefore, the Filter property value that produced the drop-down list in Figur e 5- 17 is: All Files .|.|Executable Files .exe; .dll|.exe;.dll The default value of the Filter property is an empty string, which results in an empty Files of type drop-down list. The FilterIndex property determines which filter is in force when the dialog box is initially shown. This is a 1-based index that refers to the Filter string. For example, referring again to Figur e 5- 17 , if the FilterIndex property is set to 1 , the All Files item will be selected when the dialog box is shown. If the FilterIndex is set to 2 , the Executable Files item will be shown. The default value is 1 .

5.4.4 PageSetupDialog

The PageSetupDialog component displays a dialog box that allows the user to choose page settings for a document. Certain properties in the PageSetupDialog object must be set prior to showing the dialog box. After the user clicks OK, new settings can be read from the object. See Printing in Chapt er 4 for details. Figur e 5- 18 shows an example of the PageSetupDialog dialog box. Figure 5-18. The PageSetupDialog dialog box

5.4.5 PrintDialog

The PrintDialog component displays a dialog box that allows the user to choose printer settings for a document. Certain properties in the PrintDialog object must be set prior to showing the dialog box. After the user clicks OK, new settings can be read from the object. See Printing in Chapt er 4 for details. Figur e 5- 19 shows an example of the PrintDialog dialog box. 214 Figure 5-19. The PrintDialog dialog box

5.4.6 PrintPreviewDialog

The PrintPreviewDialog component displays a dialog box that allows the user to view a document before printing it. Prior to showing the dialog box, the PrintPreviewDialog object must be loaded with information about the document to be printed. See Printing in Chapt er 4 for details. The dialog box itself displays a preview of the printed version of the document, allowing the user to navigate through it. Figur e 5- 20 shows an example of the PrintPreviewDialog dialog box, although this example doesnt have a document loaded. Figure 5-20. The PrintPreviewDialog dialog box

5.4.7 SaveFileDialog

The SaveFileDialog component displays a dialog box that allows the user to specify a filename to be used for saving. After the user clicks OK, the name of the file including the path is available in the SaveFileDialog objects FileName property which can be set prior to showing the dialog box. This causes the dialog box to initially display the given filename. Figur e 5- 21 shows an example of the SaveFileDialog dialog box. Figure 5-21. The SaveFileDialog dialog box 215 As with the OpenFileDialog component, most applications should set the InitialDirectory, Filter, and FilterIndex properties prior to calling ShowDialog. Their usage with the SaveFileDialog component is precisely the same as with OpenFileDialog.

5.5 Menus