procedure TForm1.ComboBox1Change(Sender: TObject);
var
thepchar : array[0..79] of char;
thestring : string;
theindex: integer;
begin
if combobox1.text <> '' then
begin
strpcopy(thepchar,combobox1.text);
theindex := sendmessage(combobox1.handle,cb_selectstring,-1, longint(@thepchar));
sendmessage(combobox1.handle,cb_settopindex, theindex,0);
end
else
begin
sendmessage(combobox1.handle,cb_setcursel,-1,0);
sendmessage(combobox1.handle,cb_settopindex,0,0);
end;
end;
procedure TForm1.ComboBox1Change(Sender: TObject);
var
thepchar : array[0..79] of char;
s1,thestring : string;
i,theindex: integer;
begin
s1:=combobox1.text;
if s1<>'' then
begin
for i:=combobox1.Items.Count-1 downto 0 do
begin
if not AnsiContainsText(combobox1.Items,s1) then combobox1.Items.Delete(i);
end;
end
else
begin
combobox1.Items.Clear;
combobox1.Items.AddStrings(ss);//恢复
end;
end;