RT:谢了

解决方案 »

  1.   

    1、ListBox1.Items.Delete(ListBox1.ItemIndex);//只能删除单行选择的
    2、ListBox1.DeleteSelected;                  //既可删除单行也可删除多行
    3、//既可删除单行也可删除多行,同时删除ListBox中存储的对象。
    procedure TForm1.Button1Click(Sender: TObject);
    var
     i:integer;
    begin
      for i:=ListBox1.Items.Count-1 downto 0 do
      begin
        if ListBox1.Selected[i] then
        begin
          //TYourObject(ListBox1.Items.Objects[i]).Free; //如果存储了对象数据可在此处删除
          ListBox1.Items.Delete(i);
        end;
      end;
    end;
      

  2.   

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