0% found this document useful (0 votes)
39 views19 pages

FALLSEM2024-25 CSC3004 ETH VL2024250103538 2024-08-08 Reference-Material-I

Edho oru notes enna nj theriyala neengale pathukonga

Uploaded by

teensstatusses
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views19 pages

FALLSEM2024-25 CSC3004 ETH VL2024250103538 2024-08-08 Reference-Material-I

Edho oru notes enna nj theriyala neengale pathukonga

Uploaded by

teensstatusses
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 19

Common Dialog Controls

prompt the user for filenames, font names and sizes, or colors to be used by
the application

These dialog boxes are implemented as standard controls in the Toolbox.

The common dialog controls are invisible at runtime, and they’re not placed on
your forms, because they’re implemented as modal dialog boxes and they’re
displayed as needed.
•OpenFileDialog – Lets users select a file to open. It also allows the selection of multiple
files for applications that must process many files at once.

•SaveFileDialog – Lets users select or specify the path of a file in which the current
document will be saved.

•FolderBrowserDialog – Lets users select a folder (an operation that can’t be performed
with the OpenFileDialog control).

•ColorDialog – Lets users select a color from a list of predefined colors or specify custom
colors. FontDialog Lets users select a typeface and style to be applied to the current text
selection. The Font dialog box has an Apply button, which you can intercept from within your
code and use to apply the currently selected font to the text without closing the dialog box.
OpenDialog and SaveDialog :

Prompt the user for file open and file save .

It displays all the file name in the folder.

It can be restricted by Filter property.


AddExtension

This property is a Boolean value that determines whether the dialog


box automatically adds an extension to a filename if the user omits it.

The extension added automatically is the one specified by the


DefaultExtension property, which you must set before calling the
ShowDialog method

CheckFileExists

This property is a Boolean value that indicates whether the dialog


box displays a warning if the user enters the name of a file
that does not exist in the Open dialog box, or if the user enters
the name of a file that exists in the Save dialog box.
CheckPathExists

This property is a Boolean value that indicates whether the dialog box
displays a warning if the user specifies a path that does not exist, as
part of the user-supplied filename.

DefaultExt

This property sets the default extension for the filenames


specified on the control.

Use this property to specify a default filename extension, such as .txt or


.doc, so that when a file with no extension is specified by the user, the
default extension is automatically appended to the filename.
FileName

Use this property to retrieve the full path of the file selected by
the user in the control.

Filter

This property is used to specify the type(s) of files displayed in


the dialog box.

To display text files only, set the Filter property to Text files|*.txt.

InitialDirectory

This property sets the initial folder whose files are displayed the
first time that the Open and Save dialog boxes are opened.

Use this property to display the files of the application’s folder or to


specify a folder in which the application stores its files by
FileNames

If the Open dialog box allows the selection of multiple files , the FileNames
property contains the pathnames of all selected files.

FileNames is a collection, and you can iterate through the filenames with an
enumerator.
MultiSelect

This property is a Boolean value that indicates whether the user can select
multiple files in the dialog box.

Its default value is False, and users can select a single file.

When the MultiSelect property is True, the user can select multiple files, but they
must all come from the same folder
The OpenFile and SaveFile Methods

The OpenFileDialog control exposes the OpenFile method, which allows you
to quickly open the selected file.

Likewise, the SaveFileDialog control exposes the SaveFile method, which


allows you to quickly save a document to the selected file.
ColorDialog Control

Its Color property returns the color selected by the user or


sets the initially selected color when the user opens the
dialog box.
AllowFullOpen (Boolean)

Set this property to True if you want users to be able to open the dialog
box and define their own custom colors.

AnyColor (Boolean)
This property is a Boolean value that determines whether the dialog box
displays all available colors in the set of basic colors.

Color

This is the color specified on the control.

You can set it to a color value before showing the dialog box to suggest a
reasonable selection.

On return, read the value of the same property to find out which color
was picked by the user in the control:
CustomColors

This property indicates the set of custom colors that will be shown in the
dialog box.

The Color dialog box has a section called Custom Colors, in which you can
display 16 additional custom colors.

The CustomColors property is an array of integers that represent colors.


SolidColorOnly

This indicates whether the dialog box will restrict users to selecting
solid colors only.

This setting should be used with systems that can display only 256 colors.
FontDialog Control

lets the user review and select a font and then set its size and style.

Optionally, users can also select the font’s color and even apply the current settings to
the selected text on a control of the form without closing the dialog box, by clicking the
Apply button.
AllowScriptChange

This property is a Boolean value that indicates whether the Script combo
box will be displayed in the Font dialog box.

AllowVerticalFonts
This property is a Boolean value that indicates whether the dialog box allows
the display and selection of both vertical and horizontal fonts.
Color, ShowColor (Boolean)

The Color property sets or returns the selected font color.

To enable users to select a color for the font, you must also set the
ShowColor property to True.

Font

This property is a Font object.

You can set it to the preselected font before displaying the dialog box and
assign it to a Font property upon return.
FontMustExist (Boolean)

If the user enters a font name that doesn’t correspond to a name in the
list of available fonts, a warning is displayed.

MaxSize, MinSize
These two properties are integers that determine the minimum and
maximum point size the user can specify in the Font dialog box.

ShowApply
This property is a Boolean value that indicates whether the dialog box
provides an Apply button.

Its default value is False, so the Apply button isn’t normally displayed.

If you set this property to True, you must also program the control’s Apply
event
ShowEffects

This property is a Boolean value that indicates whether the dialog box allows
the selection of special text effects, such as strikethrough and
underline.

The effects are returned to the application as attributes of the selected Font
object, and you don’t have to do anything special in your application.

You might also like