delphi ListView 排序功能


本文整理自网络,侵删。

 private
{ Private declarations }
SortCol: Integer;
SortWay: Integer;

procedure TMainFrm.ListView1ColumnClick(Sender: TObject; Column: TListColumn);
begin
SortCol:=Column.Index;
if (SortWay=1) then SortWay:=-1 else SortWay:=1;
(Sender as TCustomListView).AlphaSort;
end;

procedure TMainFrm.ListView1Compare(Sender: TObject; Item1, Item2: TListItem; Data: Integer; var Compare: Integer);
var
t: Integer;
begin
if (SortCol=0) then
begin
Compare:=SortWay * CompareText(Item1.Caption,Item2.Caption);
end else
begin
t:=SortCol-1;
Compare:=SortWay * CompareText(Item1.SubItems[t],Item2.SubItems[t]);
end;
end;

相关阅读 >>

Delphi 固定保持datetime日期格式

Delphi 反转字符串方法2

Delphi sql server 数据库转换为 access 数据库

Delphi研究之驱动开发篇(七)--利用共享内存与用户模式

Delphi edit只允许输入数字和小数点

Delphi twebbrowser与嵌入youtube视频崩溃

Delphi win32_diskdrive 硬盘 参数说明

Delphi里动态创建access的交叉表视图

Delphi获得唯一id字符串

Delphi中输入法模式imemode属性的解释

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...