本文整理自网络,侵删。
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;
相关阅读 >>
Delphi获取其他进程中listbox和combobox的内容
Delphi xe mysql数据库操作类 mysqlhelper
更多相关阅读请进入《Delphi》频道 >>