Delphi's dialog box component

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.