procedure TForm1.c_l_zxExecute(Sender: TObject);
var c,i,j,k:integer;
    s,st:string;
begin
  if list_h.Count>0 then
  begin
  list_c.Clear;
//将list_d的0-9记录(每个记录为3位数)组合后放入list_c中,
    for i:=0 to 9 do
    begin
      s:=list_d.Items.Strings[i];
      for c:=1 to 3 do
      for j:=1 to 3 do
      for k:=1 to 3 do
        begin
          st:=s[c]+s[j]+s[k];
          if list_c.Items.IndexOf(st)<0 then list_c.Items.Add(st);
        end;
    end;
//对比list_h和list_c,将list_h中与list_c中相同的删除
    c:=0;
    repeat
      for i:= 0 to list_c.Count-1 do
      if list_h.Items.Strings[c]=list_c.Items.Strings[i] then
        begin
          list_h.Items.Delete(c);
          c:=c-1;
          break;
        end;
      c:=c+1;
    until c=list_h.Count;
  end;
end;

procedure TForm1.CButton8Click(Sender: TObject);
begin
  c_l_zx.Execute;
  label1.Caption:=inttostr(list_h.Count);
  label2.Caption:=inttostr(list_c.Count);
end;

c_l_zx是action.

有三个listbox,分别是list_d、list_h、list_c。将list_d的0-9记录(每个记录为3位数)组合后放入list_c中,然后对比list_h和list_c,将list_h中与list_c中相同的删除。

问题出现在label1.Caption、label2.Caption显示后list_c会继续刷新一次,虽然内容不变,但程序会被拖住。请大家帮忙看看到底要怎样修改?