搜索sourcestrs中前几位为pyindexstr的,并写入box里,函数一个。
Procedure SearchByPYIndexStr(Const SourceStrs:TStringList;Const PYIndexStr:string; Var Box:TListBox);
label NotFound;
var
  i, j   :integer;
  hzchar :string;
begin
  box.Items.Clear;
  for i:=0 to SourceStrs.Count-1 do
    begin
      for j:=1 to Length(PYIndexStr) do
        begin
          if Length(SourceStrs[i])=0 then goto NotFound;
          hzchar:=SourceStrs[i][j];
          if PYIndexStr[j] <> hzchar
          then goto NotFound;
        end;
       box.Items.Addobject(SourceStrs[i],sourcestrs.Objects[i]);
        NotFound:
    end;
end;

解决方案 »

  1.   

    搜索sourcestrs中前几位为pyindexstr的,并写入box里,函数一个。
    Procedure SearchByPYIndexStr(Const SourceStrs:TStringList;Const PYIndexStr:string; Var Box:TListBox);
    label NotFound;
    var
      i, j   :integer;
      hzchar :string;
    begin
      box.Items.Clear;
      for i:=0 to SourceStrs.Count-1 do
        begin
          for j:=1 to Length(PYIndexStr) do
            begin
              if Length(SourceStrs[i])=0 then goto NotFound;
              hzchar:=SourceStrs[i][j];
              if PYIndexStr[j] <> hzchar
              then goto NotFound;
            end;
           box.Items.Addobject(SourceStrs[i],sourcestrs.Objects[i]);
            NotFound:
        end;
    end;
      

  2.   

    啊哈,我自己查到了  SendMessage(ComboBox1.handle, CB_SHOWDROPDOWN, 1, 0);