当前位置:网站首页>[3.delphi common components] 8 dialog box
[3.delphi common components] 8 dialog box
2022-06-11 02:12:00 【Janeb1018】
8. Dialog box
stay Delphi A series of standard dialogs are provided in .
8.1 Open the file dialog OpenDialog
Components OpenDialog Used to open an existing file , When you select a file , The selected file passes OpenDialog Of FileName attribute . Its main properties are as follows :
| attribute | explain |
|---|---|
| DefaultExt | Set the default file extension |
| Filter | Set the file type that can be opened |
| FilterIndex | Set default Filter value , Index from 1 Start |
| InitialDir | Set the initialization path of the dialog box |
| Options | Set the presentation of the dialog , Include : You can choose more 、 Long file name 、 Whether the dialog box can be resized, etc |
The main method :
| Method | explain |
|---|---|
| Execute | Open the dialog box , If you return True It means that the confirm operation is selected , If you return False It means that cancel operation is selected |
8.2 Save file dialog SaveDialog
Components SaveDialog Used to save files , The file set by the user passes SaveDialog Of FileName return . Properties and methods are the same as OpenDialog Component similarity .
8.3 Font dialog FontDialog
Font dialog FontDialog Used for font selection , You can set the font name 、 style 、 Size, etc . Choose a good result through FontDialog Of Font Property returns .
8.4 Color dialog ColorDialog
Color dialog ColorDialog For color selection , Selection result passed ColorDialog Of Color Property returns .
8.5 Use the dialog box example comprehensively
Example : stay Label The selected open file is displayed on the 、 Select the saved file 、 And set the font of the label and the color of the text .
The interface is as follows :

The code is as follows :
procedure TForm1.Button1Click(Sender: TObject); begin // Open file if OpenDialog1.Execute then Label1.Caption := ' Open file :' + OpenDialog1.FileName; end; procedure TForm1.Button2Click(Sender: TObject); begin // Save the file if SaveDialog1.Execute then Label1.Caption := ' Open file :' + SaveDialog1.FileName; end; procedure TForm1.Button3Click(Sender: TObject); begin // Font selection if FontDialog1.Execute then Label1.Font := FontDialog1.Font; end; procedure TForm1.Button4Click(Sender: TObject); begin // Color choices if ColorDialog1.Execute then Label1.Font.Color := ColorDialog1.Color; end;
边栏推荐
- Data and electricity course design: circuit of full adder / subtractor
- 从测试零基础到测试架构师,这10年,他是这样让自己成才的
- NFT Insider #61:Animoca Brands 在 340 项投资中持有 15 亿美元的加密资产
- Elsevier ---elseviewer--- preprint online publishing notice
- 浅析直播间海量聊天消息的架构设计难点
- FB02编辑Coding Block字段
- cannot import name ‘dtensor‘ from ‘tensorflow.compat.v2.experimental‘
- Task01: be familiar with the basic process of news recommendation system
- Is it appropriate for a 27 - year-old girl to change her career from zero to software testing?
- Task06: bit operation
猜你喜欢

ACM tutorial - heap sorting

Flutter status management

Me11/me12 purchase information record and condition record creation and update bapi:me_ INFORECORD_ MAINTAIN_ MULTI

Method of using dism command to backup driver in win11 system

How to reinstall win11 drawing tool when it is missing

Byte Beijing 23K and pinduoduo Shanghai 28K, how should I choose?

Enrichment of core knowledge points of interface automation to add points to the interview

Union find

SAP SMARTFORMS文本内容手动换行输出

FB02编辑Coding Block字段
随机推荐
Asemi FET 12n65 parameters, 12n65 specifications, 12n65 features
Thoughts on small steamed stuffed bun's dividend
Switch case uses enumeration classes to compare
(solved) latex -- cancel the superscript display of references in the text (gbt7714-2015 will lead to the default superscript reference) (tutorial on mixed use of superscript and flush)
SAP smartforms page feed printing automatic judgment
[traffic sign recognition] Based on Matlab GUI YCbCr feature extraction +bp neural network traffic sign recognition [including Matlab source code 1869]
ABAP CDs realizes multi line field content splicing
Sword finger offer II 095 Longest common subsequence dynamic programming
[matlab] basic image operation (point operation, arithmetic operation, scaling and rotation)
Project sorting of Online Exercise System Based on gin and Gorm
Infinite level classification (or menu) design
Win11触摸键盘主题如何更换?Win11更换触摸键盘主题的方法
SAP SMARTFORMS换页打印自动判断
The annual salary of testers in large factories ranges from 300000 to 8K a month. Roast complained that the salary was too low, but he was ridiculed by netizens?
Merge sort ()
cannot import name ‘dtensor‘ from ‘tensorflow.compat.v2.experimental‘
Secret
【MATLAB】图像压缩编码(DCT、RLE)
Internet of things final assignment - sleep quality detection system (refined version)
Win11画图工具没了怎么重新安装