Delphi 文件管理.ppt_第1页
Delphi 文件管理.ppt_第2页
Delphi 文件管理.ppt_第3页
Delphi 文件管理.ppt_第4页
Delphi 文件管理.ppt_第5页
已阅读5页,还剩8页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、第七讲 文件管理,一、基本概念:,1. 文件:同一类型元素的有序集合,是内存与外设之间传输数据的通道。 2.文件的组织与管理形式: 驱动器: 文件夹: 文件:,二、Delphi7文件管理方式:,DriverComboBox or ShellComboBox,FilelistBox or ShellListView,DirectoryListBox or ShellTreeView,1. Win3.1选项卡上的文件管理组件 驱动器组合列表框(DriveComboBox) 常用属性: DirList: 指定关联的目录列表框; Driver: 运行时属性 目录列表框(DirectoryListBox

2、) 常用属性: FileList: 指定关联的文件列表框 DirLabel: 记录当前的目录路径(When the current directory changes in the directory list box, the change is reflected in the caption of the label.) Driver: 运行时属性 Directory: 运行时属性,文件列表框(FileListBox): 常用属性: MultiSelect: Drive: 运行时属性 Diretory: 运行时属性 FileName: 运行时属性 FileType: 显示文件的属性(默认

3、ftNormal) FileEdit: set FileEdit to an edit control that displays the selected file from the file list box, as is commonly done in Open and Save dialog boxes.,type TFileAttr = (ftReadOnly, ftHidden, ftSystem, ftVolumeID, ftDirectory, ftArchive, ftNormal); TFileType = set of TFileAttr;,文件类型过滤组合列表框(Fi

4、lterComboBox) 常用属性: FileList:set FileList to allow the filter combo box to limit which files are displayed in the FileListbox. Filter:To create the value of Filter for a single file type, follow these steps: 1 Type some meaningful text to indicate the type of file. 2 Type a | character (vertical bar

5、). 3 Type the file filter. Dont put in any spaces around the | character in the string. Heres an example: FilterComboBox1.Filter := Text files|*.TXT; FilterComboBox1-Filter = Text files|*.TXT;,To specify multiple file filters, extend the value of Filter, separating each file name/mask combination wi

6、th a | character. Heres an example of two file filters that could be specified as the value of the Filter property: Text files (*.TXT)|*.TXT|Pascal files (*.PAS)|*.PAS Text files (*.TXT)|*.TXT|C+ files (*.CPP)|*.CPP,实例:,2 Samples选项卡上的文件管理组件,ShellTreeView组件: 常用属性: Root: ShellComboBox: ShellListView:

7、ShellComboBox组件: 常用属性: ShellTreeView: ShellListView:,ShellListView组件: 常用属性: ShellTreeView: ShellCombox: Viewstyle: Set ViewStyle to control the visual display of items in a list view. (vsIcon、vsList、vsSmallIcon、vsReport),实例:资源管理器,三、文件管理函数和过程:,功能:实现对文件的管理。 删除文件 文件重命名 创建文件夹 删除文件夹,function RenameFile(c

8、onst OldName, NewName: string): Boolean; example: if not RenameFile(c:abc.bmp,abc.doc) then showmessage(Can not rename file!); function DeleteFile(const FileName: string): Boolean; Description: DeleteFile deletes the file named by FileName from the disk. If the file cannot be deleted or does not exist, the function returns false. function FileExists(const FileName: string): Boolean; De

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论