?? unit_list.pas
字號(hào):
unit Unit_List;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, jpeg, ExtCtrls,ShellApi,Buttons, StdCtrls, CheckLst;
type
TFrm_List = class(TForm)
Image: TImage;
CheckListBox: TCheckListBox;
Sp_Add: TSpeedButton;
Sp_Load: TSpeedButton;
Sp_Play: TSpeedButton;
Sp_Quit: TSpeedButton;
Sp_Save: TSpeedButton;
OpenDialog: TOpenDialog;
SaveDialog: TSaveDialog;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Sp_AddClick(Sender: TObject);
procedure Sp_QuitClick(Sender: TObject);
procedure CheckListBoxDblClick(Sender: TObject);
procedure Sp_LoadClick(Sender: TObject);
procedure Sp_SaveClick(Sender: TObject);
procedure Sp_PlayClick(Sender: TObject);
procedure DragDropFiles(var msg:TMessage);message WM_DROPFILES;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Frm_List: TFrm_List;
implementation
uses Unit_Main;
{$R *.dfm}
procedure TFrm_List.FormClose(Sender: TObject; var Action: TCloseAction);
begin
try
Action:=CaFree;
Frm_Main.List_Boot:=False;
except
exit;
end;
end;
procedure TFrm_List.Sp_AddClick(Sender: TObject);
begin
try
Frm_Main.Menu_OpenM.Click;
Frm_List.CheckListBox.Items:=Frm_Main.CheckListBox.Items;
except
exit;
end;
end;
procedure TFrm_List.Sp_QuitClick(Sender: TObject);
begin
Frm_List.Close;
except
exit;
end;
end;
procedure TFrm_List.CheckListBoxDblClick(Sender: TObject);
begin
try
Frm_Main.Play_Sounder(Frm_List.CheckListBox.Items.Strings[Frm_List.CheckListBox.ItemIndex]);
Frm_Main.CheckListBox.ItemIndex:=Frm_List.CheckListBox.ItemIndex;
except
exit;
end;
end;
procedure TFrm_List.Sp_LoadClick(Sender: TObject);
begin
try
Frm_List.OpenDialog.Title := Frm_Main.Caption;
if Frm_List.OpenDialog.Execute then
Frm_Main.CheckListBox.Items.LoadFromFile(Frm_List.OpenDialog.FileName);
Frm_List.CheckListBox.Items:=Frm_Main.CheckListBox.Items;
except
exit;
end;
end;
procedure TFrm_List.Sp_SaveClick(Sender: TObject);
begin
try
Frm_List.SaveDialog.Title := Frm_Main.Caption;
if Frm_List.SaveDialog.Execute then
Frm_List.CheckListBox.Items.SaveToFile(Frm_List.SaveDialog.FileName);
except
exit;
end;
end;
procedure TFrm_List.Sp_PlayClick(Sender: TObject);
begin
try
Frm_Main.Play_Sounder(Frm_List.CheckListBox.Items.Strings[Frm_List.CheckListBox.ItemIndex]);
Frm_Main.CheckListBox.ItemIndex:=Frm_List.CheckListBox.ItemIndex;
except
exit;
end;
end;
procedure TFrm_List.DragDropFiles(var msg: TMessage);
var
char1:array[0..128]of char; // 緩沖區(qū)
char2:pchar;
i,Sum:Integer;
begin
try
// 獲得拖拉的文件數(shù)目,該功能由第二個(gè)參數(shù)決定
sum:=DragQueryFile(msg.WParam,$FFFFFFFF,nil,0);
// 顯示拖拉文件的數(shù)目
// Label1.caption:='拖過(guò)來(lái)的文件有'+inttostr(Sum)+'個(gè)。';
char2:=@char1;
for i:=0 to Sum-1 do
begin
// 獲取第i 個(gè)拖拉文件的名字,并保存在緩沖區(qū)c h a r 2 中
// 在M e m o 1 中顯示拖拉文件的名字
Frm_List.CheckListBox.Items.Add(char2);
Frm_Main.CheckListBox.Items.Add(char2);
end;
// 釋放應(yīng)用程序?yàn)閭鬟f文件名而開辟的內(nèi)存空間
DragFinish(msg.WParam);
except
exit;
end;
end;
begin
DragAcceptFiles(Handle,True);
end;
end.
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -