如TComboBox中有 
张三 
李四 
王二 
如选择了张三再选择李四,那么框中变为:张三、李四,而不是李四 
再在下拉列表中选择王二,那么框中变为:张三、李四、王二,而不是王二

解决方案 »

  1.   

    用TEdit和TCombobox组合,做一个控件,前者用来显示,后者用来选择
      

  2.   

    好像有一个ONSELECT属性吧,1.先定义一个局部变量,STR
    2.ONSELECT事件里先把COMM原先的字符传给STR
    3.COMMBOX.text := str+','+commbox.text
    4.OK
      

  3.   

    放个edit盖住combobox输入栏部分,combobox的onchange里面写:
    if not(length(edit.text)=0) then
       edit.text:=edit.text+',';
    edit.text:=exit.text+combobox.text
      

  4.   

    看看这个,哪用那么麻烦?!
    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, ExtCtrls;type
      TForm1 = class(TForm)
        ComboBox1: TComboBox;
        Timer1: TTimer;
        procedure ComboBox1DropDown(Sender: TObject);
        procedure ComboBox1Select(Sender: TObject);
        procedure FormCreate(Sender: TObject);
        procedure Timer1Timer(Sender: TObject);
      private
        { Private declarations }
        cText: string;
        PrevIndex: Integer;
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.ComboBox1DropDown(Sender: TObject);
    begin
      PrevIndex := ComboBox1.ItemIndex;
      cText := ComboBox1.Text;
    end;procedure TForm1.ComboBox1Select(Sender: TObject);
    begin
      if (ComboBox1.ItemIndex <> PrevIndex) and (ComboBox1.ItemIndex > -1) then
      begin
        if Trim(cText) = '' then
          cText := ComboBox1.Items[ComboBox1.ItemIndex]
        else
          cText := cText + ',' + ComboBox1.Items[ComboBox1.ItemIndex];
        Timer1.Enabled := False;
        Timer1.Enabled := True;
      end;
    end;procedure TForm1.FormCreate(Sender: TObject);
    begin
      Timer1.Interval := 50;
      Timer1.Enabled := False;
    end;procedure TForm1.Timer1Timer(Sender: TObject);
    begin
      Timer1.Enabled := False;
      ComboBox1.Text := cText;
      ComboBox1.SelectAll;
    end;end.
      

  5.   

    优化版,修正鼠标滚动问题unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, ExtCtrls;type
      TForm1 = class(TForm)
        ComboBox1: TComboBox;
        Timer1: TTimer;
        procedure ComboBox1DropDown(Sender: TObject);
        procedure ComboBox1Select(Sender: TObject);
        procedure FormCreate(Sender: TObject);
        procedure Timer1Timer(Sender: TObject);
      private
        { Private declarations }
        cText: string;
        PrevIndex: Integer;
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.ComboBox1DropDown(Sender: TObject);
    begin
      PrevIndex := ComboBox1.ItemIndex;
      cText := ComboBox1.Text;
    end;procedure TForm1.ComboBox1Select(Sender: TObject);
    begin
      if (ComboBox1.ItemIndex <> PrevIndex) and (ComboBox1.ItemIndex > -1) then
      begin
        if Trim(cText) = '' then
          cText := ComboBox1.Items[ComboBox1.ItemIndex]
        else
          cText := cText + ',' + ComboBox1.Items[ComboBox1.ItemIndex];
        Timer1.Enabled := False;
        Timer1.Enabled := True;
      end;
    end;procedure TForm1.FormCreate(Sender: TObject);
    begin
      Timer1.Interval := 50;
      Timer1.Enabled := False;
    end;procedure TForm1.Timer1Timer(Sender: TObject);
    begin
      if Trim(cText) <> '' then
      begin
        Timer1.Enabled := False;
        ComboBox1.Text := cText;
        ComboBox1.SelectAll;
        cText := '';
      end;
    end;end.
      

  6.   

    用Timer感觉好像有点怪怪的,不如继承一个ComboBox看有没办法改掉可能好点。
      

  7.   

    这需求真奇怪.那客户要是选错了怎么办?怎么删除?
    你要多选为什么不用TCheckListbox?用户随便点个上下键的话 就可能会选上很多不想选的项目 
      

  8.   

    楼主有个控件可以实现你的功能。TcxCheckBox(DEV的控件)但如果你不能使用第三方控件,或者要自己写的话,TComboBox估计够写了。
      

  9.   

    给你一个好的组件:XSpaceMutiSelectComboBox
    多选的,自己去下
      

  10.   

    准备一个全局的TStringList
    设置不能重复
    每次选择都把文字add进去 
    然后 text:=List的CommandText 
    应该可以 唯一难的是 在哪个事件写呢?