怎么把  delphi  checklistbox 中选中的删除(含多选)

解决方案 »

  1.   

    var
      i: integer;
    begin
      for i := CheckListBox1.Count - 1 downto 0 do
      begin
        if CheckListBox1.Checked[i] then CheckListBox1.Items.Delete(i);
      end;
    end;
      

  2.   

    放一个button,点击button,进入click事件,写以下代码procedure TForm1.Button1Click(Sender: TObject);
    var
     i:integer;
    begin
     for i:=checklistbox1.Items.Count-1  downto 0 do
     begin
        if checklistbox1.Checked[i] then
        begin
          checklistbox1.Items.Delete(i);
        end;
     end;
     end;
    end;
      

  3.   

    来晚了,哈哈var
      i: integer;
    begin
      for i := CheckListBox1.Count - 1 downto 0 do
      begin
        if CheckListBox1.Checked[i] then
          CheckListBox1.Items.Delete(i);
      end;
    end;