Subscribe

RSS Feed (xml)

Powered By

Skin Design:
Free Blogger Skins

Powered by Blogger

星期五, 9月 14, 2007

目錄交談視窗


新增5個TLabel
1個TEdit, Text=*.*
1個TFileListBox, FileEdit=Edit1, IntegralHeight=true(重新調整大小), 事件OnDbClick點兩下加入(以後用)
1個TFilterComboBox, FileList=FileListBox1, Filter=All files (*.*)*.*Executable files (*.exe)*.exeExecutable files (*.com)*.comDos batch files (*.bat)*.batDos Pif files (*.pif)*.pifWindows help files (*.hlp)*.hlpWindows bitmap files (*.bmp)*.bmpText files (*.txt)*.txt
1個TDirectoryListBox, DirLabel=Label4, FileList=FileListBox1(這兩個要在Events裡面才看得見)
1個TDriveComboBox1, DirList=DirectoryListBox1, 在事件OnChange點兩下加入(以後用)

程式碼

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, FileCtrl;

type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Edit1: TEdit;
FileListBox1: TFileListBox;
FilterComboBox1: TFilterComboBox;
DirectoryListBox1: TDirectoryListBox;
DriveComboBox1: TDriveComboBox;
Button1: TButton;
Button2: TButton;
procedure FileListBox1DblClick(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure DriveComboBox1Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
showmessage(Label4.Caption+'\'+Edit1.text);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
close;
end;

procedure TForm1.DriveComboBox1Change(Sender: TObject);
begin
DirectoryListBox1.Drive := DriveComboBox1.Drive;
FileListBox1.Drive := DriveComboBox1.Drive;
FileListBox1.Directory := DirectoryListBox1.Directory;
end;

procedure TForm1.FileListBox1DblClick(Sender: TObject);
begin
Button1.Click;
end;
end.

沒有留言: