Dialog Boxes 3 Color Dialog Font Dialog Folder

Dialog Boxes



3. Блокова схема на диалогови прозорци Color. Dialog Font. Dialog Folder. Browser. Dialog Common Dialog Open. File. Dialog Print. Dialog Page. Setup. Dialog Save. File. Dialog




7. Практическа задача • Създайте следния потребителки интерфейс. • Програмирайте бутона: Private Sub btn_Click(By. Val sender As System. Object, By. Val e As System. Event. Args) Handles btn. Click If cld 1. Show. Dialog <> Windows. Forms. Dialog. Result. Cancel Then lbl 1. Fore. Color = cld 1. Color End If End Sub


9. Свойства на Font. Dialog Allow. Simulations Gets or sets a value indicating whether the dialog box allows graphics device interface (GDI) font simulations. Allow. Vector. Fonts Gets or sets a value indicating whether the dialog box allows vector font selections. Gets or sets a value indicating whether the dialog box Allow. Vertical. Fonts displays both vertical and horizontal fonts, or only horizontal fonts. Color Gets or sets the selected font color. Fixed. Pitch. Only Gets or sets a value indicating whether the dialog box allows only the selection of fixed-pitch fonts. Font Gets or sets the selected font. Font. Must. Exist Gets or sets a value indicating whether the dialog box specifies an error condition if the user attempts to select a font or style that does not exist.

Max. Size Min. Size Scripts. Only Show. Apply Gets or sets the maximum point size a user can select. Gets or sets the minimum point size a user can select. Gets or sets a value indicating whether the dialog box allows selection of fonts for all non-OEM and Symbol character sets, as well as the ANSI character set. Gets or sets a value indicating whether the dialog box contains an Apply button. Gets or sets a value indicating whether the dialog box displays the color choice. Gets or sets a value indicating whether the dialog box contains controls that allow the user to Show. Effects specify strikethrough, underline, and text color options. Show. Color

10. Практическа задача • Създайте потребителски интерфейс с една текст бокс и бутон. • Програмирайте бутона: Private Sub Button 1_Click(sender As Object, e As Event. Args) Handles Button 1. Click If Font. Dialog 1. Show. Dialog <> Windows. Forms. Dialog. Result. Cancel Then Rich. Text. Box 1. Fore. Color = Font. Dialog 1. Color Rich. Text. Box 1. Font = Font. Dialog 1. Font End If End Sub


12. Свойства на Open. File. Dialog Property Description Gets or sets a value indicating whether the dialog box Add. Extension automatically adds an extension to a file name if the user omits the extension. Gets or sets a value indicating whether this File. Dialog Auto. Upgrade. Enable instance should automatically upgrade appearance and d behavior when running on Windows Vista. Gets or sets a value indicating whether the dialog box Check. File. Exists displays a warning if the user specifies a file name that does not exist. Gets or sets a value indicating whether the dialog box Check. Path. Exists displays a warning if the user specifies a path that does not exist. Custom. Places Gets the custom places collection for this File. Dialog instance. Default. Ext Gets or sets the default file name extension. Gets or sets a value indicating whether the dialog box Dereference. Links returns the location of the file referenced by the shortcut or whether it returns the location of the shortcut (. lnk). Gets or sets a string containing the file name selected in the File. Name file dialog box.

Filter Gets or sets the current file name filter string, which determines the choices that appear in the "Save as file type" or "Files of type" box in the dialog box. Filter. Index Gets or sets the index of the filter currently selected in the file dialog box. Initial. Directory Gets or sets the initial directory displayed by the file dialog box. Multiselect Gets or sets a value indicating whether the dialog box allows multiple files to be selected. Read. Only. Check Gets or sets a value indicating whether the ed read-only check box is selected. Gets or sets a value indicating whether the Restore. Directory dialog box restores the current directory before closing.

Safe. File. Name Gets the file name and extension for the file selected in the dialog box. The file name does not include the path. Safe. File. Names Gets an array of file names and extensions for all the selected files in the dialog box. The file names do not include the path. Show. Help Gets or sets a value indicating whether the Help button is displayed in the file dialog box. Show. Read. Only Gets or sets a value indicating whether the dialog box contains a read-only check box. Support. Multi. Dotted. Extensio Gets or sets whether the dialog box supports displaying ns and saving files that have multiple file name extensions. Title Gets or sets the file dialog box title. Validate. Names Gets or sets a value indicating whether the dialog box accepts only valid Win 32 file names.

13. Практическа задача • Създайте потребителски интерфейс с Picture Box и бутон. • Програмирайте бутона: Private Sub Button 1_Click(sender As Object, e As Event. Args) Handles Button 1. Click If Open. File. Dialog 1. Show. Dialog <> Windows. Forms. Dialog. Result. Cancel Then Picture. Box 1. Image = Image. From. File(Open. File. Dialog 1. File. Name) End If End Sub


15. Практическа задача • Създайте потребителски интерфейс с Rich. Tex. Box и бутон. • Програмирайте бутона: Private Sub Button 1_Click(sender As Object, e As Event. Args) Handles Button 1. Click Save. File. Dialog 1. Filter = "TXT Files (*. txt*)|*. txt" If Save. File. Dialog 1. Show. Dialog = Windows. Forms. Dialog. Result. OK Then My. Computer. File. System. Write. All. Text (Save. File. Dialog 1. File. Name, Rich. Text. Box 1. Text, True) End If End Sub


17. Практическа задача • Създайте потребителски интерфейс с един бутон. • Програмирайте бутона: Private Sub Button 1_Click(sender As Object, e As Event. Args) Handles Button 1. Click Print. Dialog 1. Document = Print. Document 1 Print. Dialog 1. Printer. Settings = Print. Document 1. Printer. Settings Print. Dialog 1. Allow. Some. Pages = True if Print. Dialog 1. Show. Dialog = Dialog. Result. OK Then Print. Document 1. Printer. Settings = Print. Dialog 1. Printer. Settings Print. Document 1. Print() End If End Sub
- Slides: 21