D
delphi5988
Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, CheckLst, ComCtrls;
type
TForm1 = class(TForm)
ListView1: TListView;
ListBox1: TListBox;
CheckListBox1: TCheckListBox;
Button2: TButton;
Label1: TLabel;
Label2: TLabel;
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button2Click(Sender: TObject);
var
i2,i,i3:integer ;
temp:string;
s:string;
begin
if form1.CheckListBox1.Items.Count>0 then
begin
for i := 0 to form1.CheckListBox1.Count-1 do
begin
if form1.CheckListBox1.Checked=true then
begin
temp:=form1.CheckListBox1.Items;
for i2:=0 to form1.ListView1.Items.Count-1 do
begin
if form1.ListView1.Items.Item[i2].SubItems[1]=temp then
begin
s:=form1.ListView1.Items.Item[i2].Caption;
//这个地方I2只能比Listbox.item多不会少
for i3 :=0 to form1.ListBox1.Count-1 do
begin
if form1.ListBox1.Items.Strings[i3]=s then
begin
form1.ListBox1.Items.Delete(i3);
end;
end;
end;
end;
end;
end;
end;
end;
end.
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, CheckLst, ComCtrls;
type
TForm1 = class(TForm)
ListView1: TListView;
ListBox1: TListBox;
CheckListBox1: TCheckListBox;
Button2: TButton;
Label1: TLabel;
Label2: TLabel;
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button2Click(Sender: TObject);
var
i2,i,i3:integer ;
temp:string;
s:string;
begin
if form1.CheckListBox1.Items.Count>0 then
begin
for i := 0 to form1.CheckListBox1.Count-1 do
begin
if form1.CheckListBox1.Checked=true then
begin
temp:=form1.CheckListBox1.Items;
for i2:=0 to form1.ListView1.Items.Count-1 do
begin
if form1.ListView1.Items.Item[i2].SubItems[1]=temp then
begin
s:=form1.ListView1.Items.Item[i2].Caption;
//这个地方I2只能比Listbox.item多不会少
for i3 :=0 to form1.ListBox1.Count-1 do
begin
if form1.ListBox1.Items.Strings[i3]=s then
begin
form1.ListBox1.Items.Delete(i3);
end;
end;
end;
end;
end;
end;
end;
end;
end.