OpenDialog components
OpenDialog A dialog box that is used to open a file.
Filter
This property sets the file type to click the property
Filter name sets the name of the file, the type of the filter settings file
opendialog1.filter:=' text file (*. TXT) |*. TXT';
File
The file property is the tstring type, which returns the file name string and the full pathname.
FileName
Used to set the contents of the Open File dialog box file name text box. Returns a file name and the full path name.
Title
Used to set the caption of the dialog box.
FilterIndex
When setting up multiple filter files, FilterIndex is used to set the default display file type in the file Type drop-down list.
Initiadir
Lets you set the default directory for the Open dialog box, and if it is a null value, it will open the current working directory.
Execute
Use this method to open the dialog box.
Savedialog components
The component is used to save a file dialog box, as with the properties and methods of the OpenDialog component, except that one of the options properties is an optional value of
Ofoverwriteprompt, if the value is true, then the file is saved.
FontDialog Components
The dialog box that the component uses to set the font includes the font size, color, and style.
Font
The result used to save the Font dialog box settings
Device
Used to set the device that retrieves the available fonts, Fdprinter, Fdscreen, Fdboth respectively, the printer, the screen, and the fonts that are available in both.
Minfontsize and Maxfontsize
Set the minimum and maximum size of the font, 0 means no Limit
Execute
The method opens the Font dialog box.
ColorDialog Components
Use to set color properties, including custom colors. The common properties are
Color
Used to set the initial color of the color dialog box, and more importantly, the result of saving the dialog box settings
Customcolors
Used to initialize or save a custom color.
Sample dialog Box app
procedure Tform1.button1click (sender:tobject);begin ifOpendialog1.execute () Then beginmemo1.clear; Memo1.Lines.LoadFromFile (Opendialog1.filename); End;End;procedureTform1.button5click (sender:tobject);beginForm1.closeEnd;procedureTform1.button4click (sender:tobject);begin ifColordialog1.execute () Then beginMemo1.color:=colorDialog1.Color; End;End;procedureTform1.button3click (sender:tobject);begin ifFontdialog1.execute () Then beginMemo1.font:=Fontdialog1.font; End;End;procedureTform1.button2click (sender:tobject);beginSavedialog1.filter:='Word file (*.doc) |*.doc| Textfile (*.txt) |*.txt'; ifSavedialog1.execute () Then beginMemo1.Lines.SaveToFile (savedialog1.filename); End;End;End.
Delphi's dialog box component