📄 unit1.pas
字号:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, Grids, Outline, DirOutln, ShellCtrls;
type
TForm1 = class(TForm)
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
Memo1: TMemo;
ProgressBar1: TProgressBar;
Button2: TButton;
ShellComboBox2: TShellComboBox;
list2: TShellListView;
ShellComboBox1: TShellComboBox;
list1: TShellListView;
ProgressBar2: TProgressBar;
procedure Button1Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
i: integer;
s,t,temp,dir: String;
begin
ProgressBar1.Max := memo1.Lines.Count;
ProgressBar1.Position := 0;
for i := 0 to memo1.Lines.Count - 1 do
begin
s := edit1.Text;
t := edit2.Text;
if (s[length(s)] <> '\') and (s[length(s)] <> '/') then
s := s + '\';
if (t[length(t)] <> '\') and (t[length(t)] <> '/') then
t := t + '\';
s := s + memo1.Lines[i];
t := t + memo1.Lines[i];
temp := memo1.Lines[i];
dir := edit2.Text;
while pos('/',temp) > 0 do
begin
dir := dir + '/' + copy(temp,1,pos('/',temp) - 1);
delete(temp,1,pos('/',temp));
//showmessage(dir);
// if not DirectoryExists(dir) then
CreateDir(dir);
end;
if fileexists(s) then
begin
try
copyfile(pchar(s),pchar(t),false);
except
on e: Exception do
showmessage(e.Message);
end;
end else
showmessage(memo1.Lines[i] + '没有');
ProgressBar1.Position := i + 1;
end;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
memo1.Lines.Clear;
memo1.Lines.Add(edit1.Text);
memo1.Lines.Add(edit2.Text);
memo1.Lines.SaveToFile(extractfiledir(application.ExeName) + '\copyfile.txt');
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
if fileexists(ExtractFileDir(application.ExeName) + '\copyfile.txt') then
begin
memo1.Lines.LoadFromFile(ExtractFileDir(application.ExeName) + '\copyfile.txt');
edit1.Text := memo1.Lines[0];
edit2.Text := memo1.Lines[1];
memo1.Clear;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
i: integer;
begin
for i := 0 to list1.Items.Count - 1 do
showmessage(list1.Items[i].Caption);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -