unit5.pas

来自「Source code Delphi FTP-server」· PAS 代码 · 共 82 行

PAS
82
字号
unit Unit5;

interface

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

type
  TForm5 = class(TForm)
    ListBox1: TListBox;
    ListBox2: TListBox;
    Button1: TButton;
    Button3: TButton;
    Label1: TLabel;
    Label2: TLabel;
    Button5: TButton;
    procedure Button5Click(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    Name : string;
  end;

var
  Form5: TForm5;

implementation

uses Unit1, Unit2;

{$R *.DFM}

procedure TForm5.Button5Click(Sender: TObject);
var
 i : integer;
begin
Form2.ListBox1.Items.clear;
for i:=0 to ListBox2.Items.Count-1 do
  Form2.ListBox1.Items.Add(ListBox2.Items[i]);
close;
end;

procedure TForm5.FormActivate(Sender: TObject);
var
 i,j : integer;
begin
ListBox1.Clear;
ListBox2.Clear;
j:=Form1.FtpSrvr1.UserList.IndexOf(Name);
if j >= 0 then
  for i:=1 to 20 do
    if (Form1.FtpSrvr1.UserList.GID[j,i] <> $FFFF) and
      (Form1.FtpSrvr1.GrpList.NameByGID[Form1.FtpSrvr1.UserList.GID[j,i]] <> '') then
      ListBox2.Items.Add(Form1.FtpSrvr1.GrpList.NameByGID[Form1.FtpSrvr1.UserList.GID[j,i]]);
for i:=0 to Form1.FtpSrvr1.GrpList.Count-1 do
  ListBox1.Items.Add(Form1.FtpSrvr1.GrpList.Name[i]);
ListBox1.SetFocus;
end;

procedure TForm5.Button1Click(Sender: TObject);
var
 i : integer;
begin
for i:=0 to ListBox2.Items.Count-1 do
  if ListBox2.Items[i] = ListBox1.Items[ListBox1.ItemIndex] then
    exit;
ListBox2.Items.Add(ListBox1.items[ListBox1.ItemIndex]);
end;

procedure TForm5.Button3Click(Sender: TObject);
begin
if ListBox2.ItemIndex >= 0 then
  ListBox2.Items.Delete(ListBox2.ItemIndex);
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?