function CustomSortProc(Item1, Item2: TListItem; ParamSort: integer): integer; stdcall;
implementation//之前定义上面这句procedure TForm1.ListView1ColumnClick(Sender: TObject;
Column: TListColumn);
begin
ListData.CustomSort(@CustomSortProc, Column.Index);
end;function CustomSortProc(Item1, Item2: TListItem; ParamSort: integer): integer; stdcall;
begin
if ParamSort>0 then
Result := CompareText(Item1.SubItems.Strings[ParamSort-1],Item2.SubItems.Strings[ParamSort-1])
else
Result := CompareText(Item1.Caption,Item2.Caption);
end;
implementation//之前定义上面这句procedure TForm1.ListView1ColumnClick(Sender: TObject;
Column: TListColumn);
begin
ListData.CustomSort(@CustomSortProc, Column.Index);
end;function CustomSortProc(Item1, Item2: TListItem; ParamSort: integer): integer; stdcall;
begin
if ParamSort>0 then
Result := CompareText(Item1.SubItems.Strings[ParamSort-1],Item2.SubItems.Strings[ParamSort-1])
else
Result := CompareText(Item1.Caption,Item2.Caption);
end;
可以对不同的数据子段进行排序
可以对不同的数据子段进行排序