unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Borland.Vcl.StdCtrls, System.ComponentModel, Borland.Vcl.Spin,
  Borland.Vcl.ExtCtrls;

type
  TForm1 = class(TForm)
    ListBox1: TListBox;
    ListBox2: TListBox;
    Label1: TLabel;
    Label2: TLabel;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Splitter1: TSplitter;
    SpinEdit1: TSpinEdit;
    Label3: TLabel;
    Edit1: TEdit;
    procedure SpinEdit1Change(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure ListBox1DblClick(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.nfm}

procedure TForm1.Button1Click(Sender: TObject);  //ƶѡе
var
    str:string;
    Count,i:integer;
begin
    Count := ListBox1.Items.Count;
    i := 0;
    while i<= Count-1 do
    begin
        if ListBox1.Selected[i] then
        begin
            str := ListBox1.Items[i];
            ListBox2.Items.Add(str);
            ListBox1.Items.Delete(i);
            Count:=Count-1;
        end
        else
            i := i+1;
    end;
end;

procedure TForm1.ListBox1DblClick(Sender: TObject);   //˫ƶ
var
       i:integer;
       str:string;
begin
     i:=ListBox1.ItemIndex;
     str := ListBox1.Items[i];
     ListBox2.Items.Add(str);
     ListBox1.Items.Delete(i);
end;


procedure TForm1.Button2Click(Sender: TObject);  //ListBoxе
begin
    ListBox1.Clear;
    ListBox2.Items.Clear;
end;




procedure TForm1.Button3Click(Sender: TObject);  //Ϊ ListBox1
begin
    ListBox1.Items.Add(Edit1.text);
    Edit1.text := '';
end;




procedure TForm1.SpinEdit1Change(Sender: TObject); // ListBoxо
begin
      ListBox1.ItemHeight := StrToInt(SpinEdit1.Text);
      ListBox2.ItemHeight := StrToInt(SpinEdit1.Text);
end;


end.