Delphi 7 中DBGrid的排序
2022-09-29 09:09:59 作者:admin
本文整理自网络,侵删。
procedure TfrmTraceReport.DBGrid1TitleClick(Column: TColumn);
var
SortField, FieldTitle: string;
begin
SortField := Column.Field.FieldName;
FieldTitle := Column.Title.Caption;
ShowMessage(SortField + ' ' + FieldTitle);
if Pos('▲', FieldTitle) > 0 then
begin
ConnectDM.ADOQryTraceReport.Sort := SortField + ' ASC';
FieldTitle := StringReplace(FieldTitle, '▲', '?', [rfReplaceAll]);
end
else if Pos('?', FieldTitle) > 0 then
begin
ConnectDM.ADOQryTraceReport.Sort := SortField + ' DESC';
FieldTitle := StringReplace(FieldTitle, '?', '▲', [rfReplaceAll]);
end
else
begin
ConnectDM.ADOQryTraceReport.Sort := SortField + ' DESC';
FieldTitle := FieldTitle + '?';
end;
DBGrid1.Columns[Column.Index].Title.Caption := FieldTitle;
end;
猜你喜欢
联络方式:
400-123-789
邮箱:xiachao@163.com
Q Q:12345678
微信公众号
微信二维码