看一下代码:
procedure TForm2.FormCreate(Sender: TObject);
begin
ListView1.ViewStyle := vsList;
ListView1.SortType := stText;
ListView1.Items.Add.Caption := '权威/0.5';
ListView1.Items.Add.Caption := '保证/1.0';
ListView1.Items.Add.Caption := '自己/1.7';
end;
procedure TForm2.ListView1Compare(Sender: TObject; Item1, Item2: TListItem;
Data: Integer; var Compare: Integer);
var
value1, value2: Extended;
begin
value1 := StrToFloat(Copy(item1.Caption, pos('/', item1.Caption) + 1, MaxInt)) * 1000000;
value2 := StrToFloat(Copy(item2.Caption, pos('/', item2.Caption) + 1, MaxInt)) * 1000000;
Compare := - Round(value1 - value2);
end;