在Listbox的OnDblClick事件里写 var i: integer; begin for i := 0 to ComboBox1.Items.Count - 1 do begin if ComboBox1.Items.Strings[i] = Listbox1.Items.Strings[Listbox1.ItemIndex] then exit; end; ComboBox1.Items.Add(Listbox1.Items.Strings[Listbox1.ItemIndex]); end;
procedure TForm1.ListBox1DblClick(Sender: TObject); begin if ComboBox1.Items.IndexOf(ListBox1.Items[ListBox1.ItemIndex])=-1 then ComboBox1.Items.Add(ListBox1.Items[ListBox1.ItemIndex]); end;
var
i: integer;
begin
for i := 0 to ComboBox1.Items.Count - 1 do begin
if ComboBox1.Items.Strings[i] = Listbox1.Items.Strings[Listbox1.ItemIndex] then
exit;
end;
ComboBox1.Items.Add(Listbox1.Items.Strings[Listbox1.ItemIndex]);
end;
begin
if ComboBox1.Items.IndexOf(ListBox1.Items[ListBox1.ItemIndex])=-1 then
ComboBox1.Items.Add(ListBox1.Items[ListBox1.ItemIndex]);
end;