請問如何用dbgrid控件实现"点击标题栏自动排序功能" 請問如何用dbgrid控件实现"点击标题栏自动排序功能" 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 有关双击dbgrid排序的问题,示例代码如下:procedure TForm1.DBGrid1TitleClick(Column: TColumn);var temp, title: string;begin temp := Column.FieldName; qusp.Close; if Column.Index <> lastcolumn then begin if (Pos('↑', DBGrid1.Columns[LastColumn].Title.Caption) > 0) or (Pos('↓', DBGrid1.Columns[LastColumn].Title.Caption) > 0) then DBGrid1.Columns[LastColumn].Title.Caption := Copy(DBGrid1.Columns[LastColumn].Title.Caption, 3, Length(DBGrid1.Columns[LastColumn].Title.Caption) - 2); qusp.Sql[icount] := 'order by ' + temp + ' asc'; DBGrid1.Columns[Column.Index].Title.Caption := '↑' + DBGrid1.Columns[Column.Index].Title.Caption; lastcolumn := column.Index; end else begin LastColumn := Column.Index; title := DBGrid1.Columns[LastColumn].Title.Caption; if Pos('↑', title) > 0 then begin qusp.Sql[icount] := 'order by ' + temp + ' desc'; Delete(title, 1, 2); DBGrid1.Columns[LastColumn].Title.Caption := '↓' + title; end else if Pos('↓', title) > 0 then begin qusp.Sql[icount] := 'order by ' + temp + ' asc'; Delete(title, 1, 2); DBGrid1.Columns[LastColumn].Title.Caption := '↑' + title; end else begin qusp.Sql[icount] := 'order by ' + temp + ' asc'; DBGrid1.Columns[LastColumn].Title.Caption := '↑' + title; end; end; qusp.Open;end; 如果我是用BDE連數據庫的,且dbgrid用的是第三方控件ip3000中的wwdbgrid和wwquery該怎么處理啊? 用DBGridEhUsers EhlibAdo;设置DBGridEh.dghAutoSortMarking属性为true双击DBGridEh,设置希望排序的Column的TitleButton属性为true 樓上的ron_xin(星雨) 我們公司不能用DBGridEh只是用BDE連數據庫的,且dbgrid用的是第三方控件ip3000中的wwdbgrid和wwquery象這情況我該怎么處理啊? 用DBGridEh3.6的版本Users DBClient;设置DBGridEh.OptionsEh:dghAutoSortMarking,dghMultiSortMarking属性为true双击DBGridEh,设置希望排序的Column的TitleButton属性为true 用CXGRID吧。上面直接有,连属性都不用改 delphi out of memory intraweb问题! 有过权限管理这个模块开发经验的朋友,烦请进来指点迷津,谢谢! delphi中画球体及力柱体(需源码)? 关于表单,急 请问,怎样是mediaplayer播放的时候不要指定是哪个盘,只要指定是哪个目录下就可以拉? 报表问题 表名能不能作为存储过程的参数?? 程序的在线人数统计怎么做? 日期、时间的问题 求助:怎样用多线程测试多个数据库连接? SUM与关于DBGrid显示
var
temp, title: string;
begin
temp := Column.FieldName;
qusp.Close;
if Column.Index <> lastcolumn then
begin
if (Pos('↑', DBGrid1.Columns[LastColumn].Title.Caption) > 0) or (Pos('↓', DBGrid1.Columns[LastColumn].Title.Caption) > 0) then
DBGrid1.Columns[LastColumn].Title.Caption := Copy(DBGrid1.Columns[LastColumn].Title.Caption, 3, Length(DBGrid1.Columns[LastColumn].Title.Caption) - 2);
qusp.Sql[icount] := 'order by ' + temp + ' asc';
DBGrid1.Columns[Column.Index].Title.Caption := '↑' + DBGrid1.Columns[Column.Index].Title.Caption;
lastcolumn := column.Index;
end
else
begin
LastColumn := Column.Index;
title := DBGrid1.Columns[LastColumn].Title.Caption;
if Pos('↑', title) > 0 then
begin
qusp.Sql[icount] := 'order by ' + temp + ' desc';
Delete(title, 1, 2);
DBGrid1.Columns[LastColumn].Title.Caption := '↓' + title;
end
else if Pos('↓', title) > 0 then
begin
qusp.Sql[icount] := 'order by ' + temp + ' asc';
Delete(title, 1, 2);
DBGrid1.Columns[LastColumn].Title.Caption := '↑' + title;
end
else
begin
qusp.Sql[icount] := 'order by ' + temp + ' asc';
DBGrid1.Columns[LastColumn].Title.Caption := '↑' + title;
end;
end;
qusp.Open;
end;
Users EhlibAdo;
设置DBGridEh.dghAutoSortMarking属性为true
双击DBGridEh,设置希望排序的Column的TitleButton属性为true
只是用BDE連數據庫的,且dbgrid用的是第三方控件ip3000中的wwdbgrid和wwquery象這情況我該怎么處理啊?
Users DBClient;
设置DBGridEh.OptionsEh:dghAutoSortMarking,dghMultiSortMarking属性为true
双击DBGridEh,设置希望排序的Column的TitleButton属性为true