用于只是选择,令Style := csDropDownList 

解决方案 »

  1.   

    谢谢各位:但是Style := csDropDownList 后,我读数据库表的值给combobox的text,但是它无法显示。
    Tcombobox没有readonly属性,否则我也不会来问大家了。
    Combobox1.Enabled:=False后,FORM上的COMBOBOX颜色变淡了,这不是我想要的。我仅仅是希望它的值不能被用户直接修改,想TEDIT的READONLY 那样。
      

  2.   

    ComboBox1.Style := csDropDownList;
    ComboBox1.ItemIndex := ComboBox1.Items.IndexOf('asdasdasd');
      

  3.   

    想显示出来,就指定ComboBox1.ItemIndex的值,让它大于-1就行
      

  4.   

    //也有,这样的方法,很别扭
    procedure TForm1.Button1Click(Sender: TObject);
    begin
      Edit1.Text := ComboBox1.Text;
      Edit1.Width := ComboBox1.Width;
      Edit1.Height := ComboBox1.Height;
      Edit1.Top := ComboBox1.Top;
      Edit1.Left := ComboBox1.Left;
      Edit1.Visible := True;
      ComboBox1.Visible := False;
    end;procedure TForm1.Button2Click(Sender: TObject);
    begin
      Edit1.Visible := False;
      ComboBox1.Visible := True;
    end;procedure TForm1.FormCreate(Sender: TObject);
    begin
      Edit1.ReadOnly := True;
      Edit1.Visible := False;
      Edit1.Parent := ComboBox1.Parent;
    end;
      

  5.   

    在Form放一Pannel,把Combobox放在Pannel上,设置Pannel的属性BevelInner,BevelOuter为bvNone且Enabled为False即可
      

  6.   

    在combobox的keypress事件里写上:
      key:=#0
    于是combobox变为不可以输入