tstringlist的一个方法customsort()中的参数是什么?它的作用是!我看了帮助但是不是很懂请指点!

解决方案 »

  1.   

    它是一个函数类型的参数,比如定义:
    function QckSort(List: TStringList; Index1, Index2: Integer): Integer;
    begin
      if List[Index1] > List[Index2] then Result := 1
      else if List[Index1] < List[Index2] then Result := -1
      else Result := 0;
    end;//表示TStringList的所有项按字母升序排列
    调用他:
    var
      StrList: TStringList;  
    begin
      StrList := TStringList.Create;
      //...
      StrList.CustomSort(QckSort);
    end;—————————————————————————————————
    宠辱不惊,看庭前花开花落,去留无意;毁誉由人,望天上云卷云舒,聚散任风。
    —————————————————————————————————