Common Dialog Control
description
Transcript of Common Dialog Control
*1
Common Dialog Control
*2
You want your user to set property or provide your application with some information easily? How do you do it?
The Common Dialog Control!!!
*3
Example
You want to prompt the user to open a file? How?
You could use the File List Box control, the Drive List Control, the Directory List Box control working together, responding to events… It would require coding…
OR
We could use the Common Dialog Control and write three lines of code…
*4
What does the Common Dialog Control do?
The Common Dialog control encapsulates functions for dealing with
Files
Printer
Colors
Font
Help
*5
What is the Common Dialog Control?
The common dialog control is an OCX that encapsulates the common dialog API calls built into the Windows Operating system.
*6
How Do I add the Common Dialog Control ?
From the Project Menu – Choose Components
From the Components Dialog choose the option
Microsoft Common Dialog Control.
*7
Why Use the Common Dialog Control?
These are common tasks that a user does all the time!
The User sees these common dialogs all the time!
The advantage here from the user’s point of view is that they already know how to use the dialogs. They don’t have to learn something new.
LET’S LOOK AT THESE DIALOGS ONE AT A TIME….
*8
File Dialogs
Method Dialog Output Properties
.ShowOpen
.ShowSave
Open
Save
FileName
Input Properties:
.InitDir – The initial directory folder
.Filter - This property uses the “Prompt” – “Pattern” separated by the “|” character
DEMO
*9
Font Dialog
Method Dialog Output Properties
.ShowFont Font Font
The Font dialog box allows the user to select a font by its size, color, and style.
DEMO
*10
Color Dialog
The Color dialog box allows the user to select a color from a palette or to create and select a custom color. At run time, when the user chooses a color and closes the dialog box, you use the Color property to get the selected color
DEMO
*11
Printer Dialog
The Print dialog box allows the user to specify how output should be printed. The user can specify a range of pages to be printed, a print quality, a number of copies, and so on. This dialog box also displays information about the currently installed printer and allows the user to configure or reinstall a new default printer.
Note: This dialog box does not actually send data to a printer. It allows users to specify how they want data printed. You must write code to print the data in the format they select.
DEMO
*12
Help Dialog
The Help dialog uses the older help file format. It requires the file format of .HLP. It is not really used now. The new format for help files is the compiled HTML format or CHM which can be displayed using the HTML Help API.
DEMO
*13
Conclusion
The Common Dialog Control is useful control.
It is easy to use and can sometimes save you some keystrokes.