有方便,快速的方法吗

解决方案 »

  1.   

    procedure TForm1.ComboBox1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
    begin
      ComboBox1.ItemIndex := ComboBox1.Items.IndexOf(ComboBox1.Text);
    end;
      

  2.   

    貌似 AutoComplete 属性就是干这个的吧,而且默认是 true
      

  3.   

    procedure TForm1.ComboBox1Change(Sender: TObject);
         function IsSame(Textstr,Itemstr:string):boolean;
         begin
         result:=false;
         if textstr=copy(itemstr,1,length(itemstr)) then
            result:=true;
         end;
    var
    i:integer;
    begin
    for i:=0 to combobox1.Items.Count-1 do
        if not issame(combobox1.Text,combobox1.Items[i]) then
           combobox1.Items.Delete(i);
    end;