procedure TMainForm.DelectButtonClick(Sender: TObject);
var
i:integer;
Count:integer;
begin
Count:=0;
for i:=MainFormUserListBox.Items.Count-1 downto 0 do
begin
if MainFormUserListBox.Selected[i] then
begin
MainFormUserListBox.Items.Delete(i);
inc(Count);
if Count>=MainFormUserListBox.SelCount then break;
end;
end;
MainFormUserListBox.Items.SaveToFile(CurrentDir+'\'+.....);
end;
随便写的,没有测试。
var
i:integer;
Count:integer;
begin
Count:=0;
for i:=MainFormUserListBox.Items.Count-1 downto 0 do
begin
if MainFormUserListBox.Selected[i] then
begin
MainFormUserListBox.Items.Delete(i);
inc(Count);
if Count>=MainFormUserListBox.SelCount then break;
end;
end;
MainFormUserListBox.Items.SaveToFile(CurrentDir+'\'+.....);
end;
随便写的,没有测试。
{DeleteFile(CurrentDir+'\'+UserNameLabel.Caption+'\'+'NameList'); }
AssignFile(TFile,CurrentDir+'\'+UserNameLabel.Caption+'\'+'NameList');
{reset(TFile);}CloseFile(TFile);
Erase(TFile);