Beginning Microsoft® Visual C#® 2008
by Karli Watson, Christian Nagel, Jacob Hammer Pedersen, Jon D. Reid, Morgan Skinner, Eric White
Chapter 17. Using Common Dialogs
The last three chapters looked at various aspects of programming Windows Forms applications, and how to implement such things as menus, toolbars, and SDI and MDI forms. Now you know how to display simple message boxes to get information from the user and how to create more sophisticated custom dialogs to ask the user for specific information. However, for common tasks such as opening and saving files, you can use prewritten dialog classes instead of having to create your own custom dialog.
This not only has the advantage of requiring less code, but also it uses the familiar Windows dialogs, giving your application a standard look and feel. The .NET Framework has classes that hook up to the Windows dialogs to open and create directories, to open and save files, to access printers, and to select colors and fonts.
In this chapter, you learn how to use these standard dialog classes. In particular, you will learn how to do the following:
Use the
OpenFileDialogandSaveFileDialogclassesLearn about the .NET printing class hierarchy and use the
PrintDialog, PageSetupDialog, andPrintPreviewDialogclasses to implement printing and print previewChange fonts and colors with the
FontDialogandColorDialogclasses'Use the
FolderBrowserDialogclass
Common Dialogs
A dialog is a window that is displayed within the context of another window. With a dialog, you can ask the user to enter some data before the flow of the program continues. A common dialog is one that is ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access