📄 unit1.pas
字号:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ScktComp, lxpClientSocketForFiles, lxpServerSocketForFiles,
StdCtrls, Gauges;
type
TForm1 = class(TForm)
lxpServerSocketForFiles1: TlxpServerSocketForFiles;
lxpClientSocketForFiles1: TlxpClientSocketForFiles;
Button1: TButton;
Button2: TButton;
Gauge1: TGauge;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure lxpClientSocketForFiles1SocketStatus(Sender: TObject;
Status: Word; CurrentFilesLength, FileIndex: Integer);
private
Path, DownLoadPath: String;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses FundAndProc;
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
Path := ExtractFilePath(ParamStr(0));
DownLoadPath := Path + 'DownLoad';
if not ForceDirectories(DownLoadPath) then
begin
ShowMessage('请不要在光盘上运行这个例子。');
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
with lxpServerSocketForFiles1.FilesName do
begin
Add(Path + '乖小孩.gif');
Add(Path + '双胞胎.jpg');
Add(Path + '浴血长沙 ——第三次长沙会战守城记.htm');
end;
lxpServerSocketForFiles1.Open;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
with lxpClientSocketForFiles1 do
begin
SavePath := DownLoadPath;
Host := Get_ComputerName;
Open;
end;
end;
procedure TForm1.lxpClientSocketForFiles1SocketStatus(Sender: TObject;
Status: Word; CurrentFilesLength, FileIndex: Integer);
begin
if Gauge1.MaxValue <> lxpClientSocketForFiles1.FilesLength then
Gauge1.MaxValue := lxpClientSocketForFiles1.FilesLength;
Gauge1.Progress := CurrentFilesLength;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -