[精品]cxGrid的应用方法
cxGrid的使用方法
cxGrid功能强大,适合做企业级的复杂查询。非常方便。 但是对其用法介绍的并不多,在此总结他人的使用经验和自己的一点小经验,供大家参考。
(,)动态设置显示
格式
pdf格式笔记格式下载页码格式下载公文格式下载简报格式下载
procedure,,,,,SetDisplayFormat(ACtrlData:,,,,,TClientDataSet;
,,,,,TbView:,,,,,TcxGridDBTableView);
var
,,,,,i:,,,,,integer;
begin
,,,,,if,,,,,ACtrlData.RecordCount,,,,,<=,,,,,0,,,,,then,,,,,Exit;
,,,,,try
,,,,, ,,,,,TbView.ClearItems;
,,,,, ,,,,,ACtrlData.First;
,,,,, ,,,,,for,,,,,i,,,,,:=,,,,,0,,,,,to,,,,,ACtrlData.RecordCount,,,,,-,,,,,1,,,,,do
,,,,, ,,,,,begin
,,,,, ,,,,, ,,,,,if,,,,,ACtrlData.FieldByName('SQBF_DisplayInGrid').AsString,,,,,=,,,,,'1',,,,,then,,,,,//在
表格
关于规范使用各类表格的通知入职表格免费下载关于主播时间做一个表格详细英语字母大小写表格下载简历表格模板下载
中显示
,,,,, ,,,,, ,,,,,with,,,,,TbView.CreateColumn,,,,,do
,,,,, ,,,,, ,,,,,begin
,,,,, ,,,,, ,,,,, ,,,,,DataBinding.FieldName,,,,,:=,,,,,ACtrlData.FieldByName('SQBF_FieldName').AsString;
,,,,, ,,,,, ,,,,, ,,,,,Caption,,,,,:=,,,,,ACtrlData.FieldByName('SQBF_Caption').AsString;,,,,,//字段中文标题
,,,,, ,,,,, ,,,,, ,,,,,Hint,,,,,:=,,,,,ACtrlData.FieldByName('SQBF_Hint').AsString;
,,,,, ,,,,, ,,,,, ,,,,,Width,,,,,:=,,,,,ACtrlData.FieldByName('SQBF_Width').AsInteger;
,,,,, ,,,,, ,,,,, ,,,,,HeaderAlignmentHorz,,,,,:=,,,,,taCenter;
,,,,, ,,,,, ,,,,,end;
,,,,, ,,,,, ,,,,,ACtrlData.Next;
,,,,, ,,,,,end;
,,,,,except
,,,,, ,,,,,on,,,,,E:,,,,,Exception,,,,,do
,,,,, ,,,,, ,,,,,SaveLog('设置显示格式时出错:',,,,,+,,,,,E.Message);
,,,,,end;
end;
(,)显示行号
procedure,,,,,TFmQueryBase.cxDBViewMasterCustomDrawIndicatorCell(
,,,,,Sender:,,,,,TcxGridTableView;,,,,,ACanvas:,,,,,TcxCanvas;
,,,,,AViewInfo:,,,,,TcxCustomGridIndicatorItemViewInfo;,,,,,var,,,,,ADone:,,,,,Boolean);
var
,,,,,FValue:,,,,,string;
,,,,,FBounds:,,,,,TRect;
begin
,,,,,FBounds,,,,,:=,,,,,AViewInfo.Bounds;
,,,,,if,,,,,(AViewInfo,,,,,is,,,,,TcxGridIndicatorRowItemViewInfo),,,,,then
,,,,,begin
,,,,, ,,,,,ACanvas.FillRect(FBounds);
,,,,, ,,,,,ACanvas.DrawComplexFrame(FBounds,,,,,,clBlack,,,,,,clBlack,,,,,,[bBottom,,,,,,bLeft,,,,,,bRight],,,,,,1);
,,,,, ,,,,,FValue,,,,,:=,,,,,IntToStr(TcxGridIndicatorRowItemViewInfo(AViewInfo).GridRecord.Index+1);
,,,,, ,,,,,InflateRect(FBounds,,,,,,-3,,,,,,-2);,,,,,//Platform,,,,,specific.,,,,,May,,,,,not,,,,,work,,,,,on,,,,,Linux.
,,,,, ,,,,,ACanvas.Font.Color,,,,,:=,,,,,clBlack;
,,,,, ,,,,,ACanvas.Brush.Style,,,,,:=,,,,,bsClear;
,,,,, ,,,,,ACanvas.DrawText(FValue,,,,,,FBounds,,,,,,cxAlignCenter,,,,,or,,,,,cxAlignTop);
,,,,, ,,,,,ADone,,,,,:=,,,,,True;
,,,,,end;
end;
(,)设置显示格式,我的项目要求先动态添加字段,这时不知道字段类型,所以设置DisplayFormat
不方便,我还没有找到好方法。
所以采用打开数据集后再设置:
procedure,,,,,TFmQueryBase.cdsMasterAfterOpen(DataSet:,,,,,TDataSet);
var
,,,,,i:,,,,,Integer;
begin
,,,,,for,,,,,i,,,,,:=,,,,,0,,,,,to,,,,,cxDBViewMaster.DataController.DataSet.FieldCount,,,,,-1,,,,,do
,,,,,begin
,,,,, ,,,,,if,,,,,cxDBViewMaster.DataController.DataSet.Fields[i],,,,,is,,,,,TNumericField,,,,,then
,,,,, ,,,,,begin
,,,,, ,,,,, ,,,,,if,,,,,Pos('AMOUNT',,,,,,UpperCase(cxDBViewMaster.DataController.DataSet.Fields[i].FieldName)),,,,,
>,,,,,0,,,,,then
,,,,, ,,,,, ,,,,,begin
,,,,, ,,,,, ,,,,, ,,,,,TNumericField(cxDBViewMaster.DataController.DataSet.Fields[i]).DisplayFormat,,,,,:=,,,,,'#,##0.0
00';
,,,,, ,,,,, ,,,,, ,,,,,Continue;
,,,,, ,,,,, ,,,,,end;
,,,,, ,,,,, ,,,,,if,,,,,Pos('QUANTITY',,,,,,UpperCase(cxDBViewMaster.DataController.DataSet.Fields[i].FieldName)),,
,,,>,,,,,0,,,,,then
,,,,, ,,,,, ,,,,,begin
,,,,, ,,,,, ,,,,, ,,,,,TNumericField(cxDBViewMaster.DataController.DataSet.Fields[i]).DisplayFormat,,,,,:=,,,,,'#,##0.0
00';
,,,,, ,,,,, ,,,,, ,,,,,Continue;
,,,,, ,,,,, ,,,,,end;
,,,,, ,,,,, ,,,,, if,,,,,Pos('MONEY',,,,,,UpperCase(cxDBViewMaster.DataController.DataSet.Fields[i].FieldName)),,,,,
>,,,,,0,,,,,then
,,,,, ,,,,, ,,,,,begin
,,,,, ,,,,, ,,,,, ,,,,,TNumericField(cxDBViewMaster.DataController.DataSet.Fields[i]).DisplayFormat,,,,,:=,,,,,'#,##0.0
0';
,,,,, ,,,,, ,,,,, ,,,,,Continue;
,,,,, ,,,,, ,,,,,end;
,,,,, end;
,,,,,end;
end;
最近在学习使用cxGrid,安装的版本是ExpressQuantumGrid,,,,, ,,,,,Suite,,,,, ,,,,,v5.10,,,,, ,,,,,
,,,,,我发现这个控件功能虽然强大,但是非常难用。,,,,, ,,,,,
,,,,, ,,,,,
,,,,,现在我手头就有几个问题还没解决:,,,,, ,,,,,
,,,,,1)主从模式下导出Excel中文会产生乱码,而且从
表
关于同志近三年现实表现材料材料类招标技术评分表图表与交易pdf视力表打印pdf用图表说话 pdf
内容
财务内部控制制度的内容财务内部控制制度的内容人员招聘与配置的内容项目成本控制的内容消防安全演练内容
没有导出。,,,,, ,,,,,
,,,,,我不知道是不是因为我的字段名包括单引号的原因。,,,,, ,,,,,
,,,,,导出代码:ExportGrid4ToExcel(FileName,,,,,, ,,,,,cxGrid);,,,,, ,,,,,
,,,,, ,,,,,
,,,,,2)主从模式下通过按钮对从表添加/删除行,代码怎幺写。,,,,, ,,,,,
,,,,,附:单表添加/删除行的代码,,,,, ,,,,,
,,,,,procedure,,,,, ,,,,,TFormAccount.cxButtonNewClick(Sender:,,,,, ,,,,,TObject);,,,,, ,,,,,
,,,,,begin,,,,, ,,,,,
,,,,, ,,,,, ,,,,,Self.tvAccount.DataController.Append;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,Self.tvAccount.Columns[0].Focused,,,,, ,,,,,:=,,,,, ,,,,,True;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,cxGrid.SetFocus;,,,,, ,,,,,
,,,,,end;,,,,, ,,,,,
,,,,, ,,,,,
,,,,,procedure,,,,, ,,,,,TFormAccount.cxButtonDeleteClick(Sender:,,,,, ,,,,,TObject);,,,,, ,,,,,
,,,,,begin,,,,, ,,,,,
,,,,, ,,,,, ,,,,,if,,,,, ,,,,,Self.tvAccount.DataController.RowCount,,,,, ,,,,,=,,,,, ,,,,,0,,,,, ,,,,,then,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,Exit;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,if,,,,, ,,,,,Application.MessageBox('确认删除当前记录?',,,,,, ,,,,,'确认删除',,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,MB_YesNo,,,,, ,,,,,+,,,,, ,,,,,MB_IconQuestion),,,,, ,,,,,=,,,,, ,,,,,IDNO,,,,, ,,,,,then,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,Exit;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,Self.tvAccount.DataController.DeleteFocused;,,,,, ,,,,,
,,,,,end;,,,,, ,,,,,
,,,,, ,,,,,
,,,,,3)动态创建主从结构出错(Compiler没错,运行时出现系统错误0000000018),,,,,, ,,,,,
,,,,,我使用了二个ADOStoreProcedure作主从表,,,,, ,,,,,
,,,,,代码如下:,,,,, ,,,,,
,,,,,var,,,,, ,,,,,
,,,,, ,,,,, ,,,,,Level:,,,,, ,,,,,TcxGridLevel;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,GridView:,,,,, ,,,,,TcxGridDBTableView;,,,,, ,,,,,
,,,,,begin,,,,, ,,,,,
,,,,, ,,,,, ,,,,,Level,,,,, ,,,,,:=,,,,, ,,,,,cxGrid1.Levels[0].Add;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,GridView,,,,, ,,,,,:=,,,,, ,,,,,TcxGridDBTableView(cxGrid1.CreateView(TcxGridDBTableView));,,,,, ,,,,,
,,,,, ,,,,, ,,,,,GridView.DataController.DataSource,,,,, ,,,,,:=,,,,, ,,,,,Self.dsDetail;,,,,, ,,,,,
,,,,, ,,,,,
,,,,, ,,,,, ,,,,,GridView.DataController.KeyFieldNames,,,,, ,,,,,:=,,,,, ,,,,,'PurchOrderID;POLineNbr;PromiseDate;ReceiverDate';,,,,, ,,,,,
,,,,, ,,,,, ,,,,,GridView.DataController.MasterKeyFieldNames,,,,, ,,,,,:=,,,,, ,,,,,'VendorID';,,,,, ,,,,,
,,,,, ,,,,, ,,,,,GridView.DataController.DetailKeyFieldNames,,,,, ,,,,,:=,,,,, ,,,,,'VendorID';,,,,, ,,,,,
,,,,, ,,,,, ,,,,,GridView.DataController.DataModeController.SmartRefresh,,,,, ,,,,,:=,,,,, ,,,,,True;,,,,, ,,,,,
,,,,, ,,,,,
,,,,, ,,,,, ,,,,,GridView.OptionsCustomize.ColumnHiding,,,,, ,,,,,:=,,,,, ,,,,,True;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,GridView.OptionsCustomize.ColumnsQuickCustomization,,,,, ,,,,,:=,,,,, ,,,,,True;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,GridView.OptionsData.Deleting,,,,, ,,,,,:=,,,,, ,,,,,False;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,GridView.OptionsData.Inserting,,,,, ,,,,,:=,,,,, ,,,,,False;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,GridView.OptionsView.Indicator,,,,, ,,,,,:=,,,,, ,,,,,True;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,Level.GridView,,,,, ,,,,,:=,,,,, ,,,,,GridView;,,,,, ,,,,,
,,,,, ,,,,,
,,,,, ,,,,, ,,,,,GridView,,,,, ,,,,,:=,,,,, ,,,,,TcxGridDBTableView(cxGrid1.Levels[0].GridView);,,,,, ,,,,,
,,,,, ,,,,, ,,,,,GridView.DataController.KeyFieldNames,,,,, ,,,,,:=,,,,, ,,,,,'VendorID';,,,,, ,,,,,
,,,,, ,,,,, ,,,,,GridView.OptionsView.GroupByBox,,,,, ,,,,,:=,,,,, ,,,,,False;,,,,, ,,,,,
,,,,, ,,,,,
,,,,, ,,,,, ,,,,,//显示主表内容,,,,, ,,,,,
,,,,, ,,,,, ,,,,,tvResult.BeginUpdate;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,tvResult.ClearItems;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,tvResult.DataController.CreateAllItems;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,tvResult.EndUpdate;,,,,, ,,,,,
,,,,, ,,,,,
,,,,, ,,,,, ,,,,,//显示明细表内容,,,,, ,,,,,
,,,,, ,,,,, ,,,,,GridView,,,,, ,,,,,:=,,,,, ,,,,,TcxGridDBTableView(cxGrid1.Levels[0].Items[0].GridView);,,,,, ,,,,,
,,,,, ,,,,, ,,,,,GridView.BeginUpdate;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,GridView.ClearItems;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,GridView.DataController.CreateAllItems;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,GridView.DataController.Refresh;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,GridView.EndUpdate;,,,,, ,,,,,
,,,,,end;,,,,, ,,,,,
,,,,,
此楼回复Re: ,,,,,
小技巧:用代码展开/收缩主从结构,,,,, ,,,,,
,,,,,Self.tvDepartment.ViewData.Expand(True);,,,,, ,,,,,
,,,,,Self.tvDepartment.ViewData.Collaspe(True);,,,,, ,,,,,
,,,,,注:tvDepartment为主表对应的TableView
此楼回复Re: ,,,,,
你说的这几个问题我也遇到过。,,,,, ,,,,,
,,,,,第一个问题是编码的问题,修改了其中关于编码的函数,OK.,,,,, ,,,,,
,,,,,第二个问题在cxGrid的社区可以找到解答,但从表必须满足某种条件,例如关键字排序。,,,,, ,,,,,
,,,,,第三个问题的解决办法,你可以尝试在动态创建的代码前后加上:,,,,, ,,,,,
,,,,,grid.beginupdate;,,,,, ,,,,,
,,,,,...,,,,, ,,,,,
,,,,,grid.endupdate,,,,, ,,,,,
,,,,,来解决。
此楼回复Re: ,,,,,
没用过,,,,, ,,,,,
,,,,,不要经常使用三方控件
此楼回复Re: ,,,,,
to,,,,, ,,,,,tttk(网络芝麻):,,,,, ,,,,,
,,,,,第一个问题:如何修改啊,贴出代码,,,,, ,,,,,
,,,,,第二个问题:没搜到啊,,,,, ,,,,,
,,,,,第三个问题:试一下再说
此楼回复Re: ,,,,,
不要经常使用三方控件,,,,, ,,,,,
,,,,,======================,,,,, ,,,,,
,,,,,我感觉不用cxGrid的话,没必要用Delphi了,呵呵
此楼回复Re: ,,,,,
楼上这话是不是有点问题?DELPHI能做得事情很多很多,难道非要用CXGRID?CXGRID不是用DELPHI做出来得?
此楼回复Re: ,,,,,
没用过.....
此楼回复Re: ,,,,,
回复人:,,,,, ,,,,,zxkid(没有人会像我这样...),,,,, ,,,,,(,,,,, ,,,,,),,,,, ,,,,,信誉:
101,,,,, ,,,,, ,,,,,2006-01-06,,,,, ,,,,,16:58:00,,,,, ,,,,, ,,,,,得分:,,,,, ,,,,,0,,,,, ,,,,, ,,,,, ,,,,,
,,,,, ,,,,, ,,,,,
,,,,, ,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,,不要经常使用三方控件,,,,, ,,,,,
,,,,,======================,,,,, ,,,,,
,,,,,我感觉不用cxGrid的话,没必要用Delphi了,呵呵,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,,
,,,,, ,,,,, ,,,,,
,,,,,**********,,,,, ,,,,,
,,,,,楼主乃天人也~~
此楼回复Re: ,,,,,
呵呵
此楼回复Re: ,,,,,
cxGrid比较不错,我也使用过导出到Excel,没有遇到你说的乱码,,,,, ,,,,,
,,,,, ,,,,,
,,,,,主从表也没有问题的,其实跟单表操作还不是一回事
此楼回复Re: ,,,,,
up
此楼回复Re: ,,,,,
没用过cxGrid,以后考虑
此楼回复Re: ,,,,,
楼主乃天人也~~,,,,, ,,,,,
,,,,,=============================,,,,, ,,,,,
,,,,,Delphi下有cxGrid,,,,,, ,,,,,.NET下有XtraGrid,,,,,, ,,,,,它们都是同一公司出的。,,,,, ,,,,,
,,,,,迟早都会转到.NET,所以。。。
此楼回复Re: ,,,,,
路过
此楼回复Re: ,,,,,
用过,挺好,只会使用最简单的。
此楼回复Re: ,,,,,
发一个邮件给我,我把解决乱码后的源代码发一分给你,放到你的项目文件夹下即可。,,,,, ,,,,,
,,,,,tttk2000@hotmail.com
此楼回复Re: ,,,,,
第二个问题:;issueid=B2691
此楼回复Re: ,,,,,
谢谢tttk(网络芝麻),,,,, ,,,,, ,,,,,
,,,,, ,,,,,
,,,,,第二个问题:我现在直接让用户用导航条的删除/添加按钮了。根据你给的网址上的内容我知道大概该怎幺写了,有空再试试。,,,,, ,,,,,
,,,,, ,,,,,
,,,,,第一个问题:不光是乱码问题,还有从表内容没导出的问题。,,,,, ,,,,,
,,,,,只有一个表的话是不会出现乱码的。,,,,, ,,,,,
,,,,, ,,,,,
,,,,,第三个问题:还没来得及试。
此楼回复Re: ,,,,,
第一个问题:看了一下帮助,原来cxGrid不支持主从表的导出,只能导出主表(顶层表)的内容。晕
此楼回复Re: ,,,,,
贴一些小技巧,希望与各位使用cxGrid的朋友共同交流,,,,, ,,,,,
,,,,,各位有什幺好个技巧也可以贴出来:,,,,, ,,,,,
,,,,, ,,,,,
,,,,,技巧二:在内置右键菜单的后面增加菜单项,,,,, ,,,,,
,,,,, ,,,,,
,,,,,首先应在Form上加一个cxGridPopupMenu控件,,,,, ,,,,,以启用右键菜单,,,,, ,,,,,
,,,,,UseBuildInPopupMenus设为True,,,,, ,,,,,
,,,,, ,,,,,
,,,,,procedure,,,,, ,,,,,TFormItemList.FormCreate(Sender:,,,,, ,,,,,TObject);,,,,, ,,,,,
,,,,,var,,,,, ,,,,,
,,,,, ,,,,, ,,,,,AMenu:,,,,, ,,,,,TComponent;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,FMenuItem,,,,,, ,,,,,FSubMenuItem:,,,,, ,,,,,TMenuItem;,,,,, ,,,,,
,,,,,begin,,,,, ,,,,,
,,,,, ,,,,, ,,,,,AMenu,,,,, ,,,,,:=,,,,, ,,,,,nil;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,if,,,,, ,,,,,cxGridPopupMenu.BuiltInPopupMenus.Count,,,,, ,,,,,=,,,,, ,,,,,0,,,,, ,,,,,then,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,Exit;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,AMenu,,,,, ,,,,,:=,,,,, ,,,,,cxGridPopupMenu.BuiltInPopupMenus[0].PopupMenu;,,,,,//第一个内置右键菜单(表头菜单),,,,, ,,,,,
,,,,, ,,,,, ,,,,,if,,,,, ,,,,,Assigned(AMenu),,,,, ,,,,,and,,,,, ,,,,,AMenu.InheritsFrom(TPopupMenu),,,,, ,,,,,then,,,,, ,,,,,
,,,,, ,,,,, ,,,,,begin,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,TPopupMenu(AMenu).AutoHotkeys,,,,, ,,,,,:=,,,,, ,,,,,maManual;,,,,, ,,,,, ,,,,, ,,,,, ,,,,,//手动热键,,,,, ,,,,,
,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,//-------------------------,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem,,,,, ,,,,,:=,,,,, ,,,,,TMenuItem.Create(Self);,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem.Caption,,,,, ,,,,,:=,,,,, ,,,,,'-';,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem.Name,,,,, ,,,,,:=,,,,, ,,,,,'miLineForGroup';,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,TPopupMenu(AMenu).Items.Add(FMenuItem);,,,,, ,,,,,
,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,//展开所有组,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem,,,,, ,,,,,:=,,,,, ,,,,,TMenuItem.Create(Self);,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem.Name,,,,, ,,,,,:=,,,,, ,,,,,'miExpandAllGroup';,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem.Caption,,,,, ,,,,,:=,,,,, ,,,,,'展开所有组(&X)';,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem.OnClick,,,,, ,,,,,:=,,,,, ,,,,,miExpandAllGroupClick;,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,TPopupMenu(AMenu).Items.Add(FMenuItem);,,,,, ,,,,,
,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,//收缩所有组,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem,,,,, ,,,,,:=,,,,, ,,,,,TMenuItem.Create(Self);,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem.Name,,,,, ,,,,,:=,,,,, ,,,,,'miCollapseAllGroup';,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem.Caption,,,,, ,,,,,:=,,,,, ,,,,,'收缩所有组(&O)';,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem.OnClick,,,,, ,,,,,:=,,,,, ,,,,,miCollapseAllGroupClick;,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,TPopupMenu(AMenu).Items.Add(FMenuItem);,,,,, ,,,,,
,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,//-------------------------,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem,,,,, ,,,,,:=,,,,, ,,,,,TMenuItem.Create(Self);,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem.Caption,,,,, ,,,,,:=,,,,, ,,,,,'-';,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,TPopupMenu(AMenu).Items.Add(FMenuItem);,,,,, ,,,,,
,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,//过滤面板,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem,,,,, ,,,,,:=,,,,, ,,,,,TMenuItem.Create(Self);,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem.Name,,,,, ,,,,,:=,,,,, ,,,,,'miFilterPanel';,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem.Caption,,,,, ,,,,,:=,,,,, ,,,,,'过滤面板(&P)';,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,//自动显示,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FSubMenuItem,,,,, ,,,,,:=,,,,, ,,,,,TMenuItem.Create(Self);,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FSubMenuItem.Name,,,,, ,,,,,:=,,,,, ,,,,,'miFilterPanelAuto';,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FSubMenuItem.Caption,,,,, ,,,,,:=,,,,, ,,,,,'自动(&A)';,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FSubMenuItem.RadioItem,,,,, ,,,,,:=,,,,, ,,,,,True;,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FSubMenuItem.GroupIndex,,,,, ,,,,,:=,,,,, ,,,,,5;,,,,,//指定同一组,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FSubMenuItem.Checked,,,,, ,,,,,:=,,,,, ,,,,,True;,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FSubMenuItem.OnClick,,,,, ,,,,,:=,,,,, ,,,,,miFilterPanelClick;,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem.Add(FSubMenuItem);,,,,,//加入二级子菜单,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,//总是显示,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FSubMenuItem,,,,, ,,,,,:=,,,,, ,,,,,TMenuItem.Create(Self);,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FSubMenuItem.Name,,,,, ,,,,,:=,,,,, ,,,,,'miFilterPanelAlways';,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FSubMenuItem.Caption,,,,, ,,,,,:=,,,,, ,,,,,'总是显示(&W)';,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FSubMenuItem.RadioItem,,,,, ,,,,,:=,,,,, ,,,,,True;,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FSubMenuItem.GroupIndex,,,,, ,,,,,:=,,,,, ,,,,,5;,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FSubMenuItem.OnClick,,,,, ,,,,,:=,,,,, ,,,,,miFilterPanelClick;,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem.Add(FSubMenuItem);,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,//从不显示,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FSubMenuItem,,,,, ,,,,,:=,,,,, ,,,,,TMenuItem.Create(Self);,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FSubMenuItem.Name,,,,, ,,,,,:=,,,,, ,,,,,'miFilterPanelNerver';,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FSubMenuItem.Caption,,,,, ,,,,,:=,,,,, ,,,,,'从不显示(&N)';,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FSubMenuItem.RadioItem,,,,, ,,,,,:=,,,,, ,,,,,True;,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FSubMenuItem.GroupIndex,,,,, ,,,,,:=,,,,, ,,,,,5;,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FSubMenuItem.OnClick,,,,, ,,,,,:=,,,,, ,,,,,miFilterPanelClick;,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem.Add(FSubMenuItem);,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,TPopupMenu(AMenu).Items.Add(FMenuItem);,,,,, ,,,,,
,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,//自定义过滤,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem,,,,, ,,,,,:=,,,,, ,,,,,TMenuItem.Create(Self);,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem.Name,,,,, ,,,,,:=,,,,, ,,,,,'miCustomFilter';,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem.Caption,,,,, ,,,,,:=,,,,, ,,,,,'自定义过滤(&M)';,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem.OnClick,,,,, ,,,,,:=,,,,, ,,,,,miCustomFilterClick;,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,TPopupMenu(AMenu).Items.Add(FMenuItem);,,,,, ,,,,,
,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,//过滤管理器,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem,,,,, ,,,,,:=,,,,, ,,,,,TMenuItem.Create(Self);,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem.Name,,,,, ,,,,,:=,,,,, ,,,,,'miFilterBuilder';,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,TPopupMenu(AMenu).Images.AddImage(FormMain.ImageListExtend,,,,,, ,,,,,44);,,,,,//添加图标图像,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem.ImageIndex,,,,, ,,,,,:=,,,,, ,,,,,TPopupMenu(AMenu).Images.Count,,,,, ,,,,,-,,,,, ,,,,,1;
,,,,,//指定图标序号,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem.Caption,,,,, ,,,,,:=,,,,, ,,,,,'过滤管理器';,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem.OnClick,,,,, ,,,,,:=,,,,, ,,,,,Self.miFilterBuilderClick;,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,TPopupMenu(AMenu).Items.Add(FMenuItem);,,,,, ,,,,,
,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,//---------------------,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem,,,,, ,,,,,:=,,,,, ,,,,,TMenuItem.Create(Self);,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem.Caption,,,,, ,,,,,:=,,,,, ,,,,,'-';,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,TPopupMenu(AMenu).Items.Add(FMenuItem);,,,,, ,,,,,
,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,//导出,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem,,,,, ,,,,,:=,,,,, ,,,,,TMenuItem.Create(Self);,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem.Name,,,,, ,,,,,:=,,,,, ,,,,,'miExport';,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,TPopupMenu(AMenu).Images.AddImage(FormMain.ImageListExtend,,,,,, ,,,,,37);,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem.ImageIndex,,,,, ,,,,,:=,,,,, ,,,,,TPopupMenu(AMenu).Images.Count,,,,, ,,,,,-,,,,, ,,,,,1;,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem.Caption,,,,, ,,,,,:=,,,,, ,,,,,'导出(&E)';,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem.OnClick,,,,, ,,,,,:=,,,,, ,,,,,Self.miExportClick;,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,TPopupMenu(AMenu).Items.Add(FMenuItem);,,,,, ,,,,,
,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,//打印,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem,,,,, ,,,,,:=,,,,, ,,,,,TMenuItem.Create(Self);,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem.Name,,,,, ,,,,,:=,,,,, ,,,,,'miPrint';,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem.Caption,,,,, ,,,,,:=,,,,, ,,,,,'打印(&P)';,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,TPopupMenu(AMenu).Images.AddImage(FormMain.ImageListExtend,,,,,, ,,,,,14);,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem.ImageIndex,,,,, ,,,,,:=,,,,, ,,,,,TPopupMenu(AMenu).Images.Count,,,,, ,,,,,-,,,,, ,,,,,1;,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FMenuItem.OnClick,,,,, ,,,,,:=,,,,, ,,,,,Self.miPrintClick;,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,TPopupMenu(AMenu).Items.Add(FMenuItem);,,,,, ,,,,,
,,,,, ,,,,, ,,,,,end;,,,,, ,,,,,
,,,,,end;,,,,, ,,,,,
,,,,, ,,,,,
,,,,,procedure,,,,, ,,,,,TFormItemList.miExportClick(Sender:,,,,, ,,,,,TObject);,,,,, ,,,,,
,,,,,var,,,,, ,,,,,
,,,,, ,,,,, ,,,,,FileName,,,,,, ,,,,,FileExt,,,,,, ,,,,,msg:,,,,, ,,,,,String;,,,,, ,,,,,
,,,,,begin,,,,, ,,,,,
,,,,, ,,,,, ,,,,,if,,,,, ,,,,,Self.aqyQuery.IsEmpty,,,,, ,,,,,then,,,,, ,,,,,
,,,,, ,,,,, ,,,,,begin,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,msg,,,,, ,,,,,:=,,,,, ,,,,,'没有导出数据...';,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,Application.MessageBox(PChar(msg),,,,,, ,,,,,PChar(Application.Title),,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,, ,,,,, ,,,,,MB_OK,,,,, ,,,,,or,,,,, ,,,,,MB_IconWarning);,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,Exit;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,end;,,,,, ,,,,,
,,,,, ,,,,,
,,,,, ,,,,, ,,,,,Self.SaveDialogExport.Filter,,,,, ,,,,,:=,,,,, ,,,,,'Excel文件,,,,, ,,,,,(*.xls)|*.xls|XML文件,,,,, ,,,,,(*.xml)|*.xml',,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,+,,,,, ,,,,,'|文本文件,,,,, ,,,,,(*.txt)|*.txt|网页文件,,,,, ,,,,,(*.html)|*.html';,,,,, ,,,,,
,,,,, ,,,,, ,,,,,Self.SaveDialogExport.Title,,,,, ,,,,,:=,,,,, ,,,,,'导出为';,,,,, ,,,,,
,,,,, ,,,,,
,,,,, ,,,,, ,,,,,if,,,,, ,,,,,not,,,,, ,,,,,Self.SaveDialogExport.Execute,,,,, ,,,,,then,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,Exit;,,,,, ,,,,,
,,,,, ,,,,,
,,,,, ,,,,, ,,,,,FileName,,,,, ,,,,,:=,,,,, ,,,,,Self.SaveDialogExport.FileName;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,FileExt,,,,, ,,,,,:=,,,,, ,,,,,LowerCase(ExtractFileExt(FileName));,,,,, ,,,,,
,,,,, ,,,,, ,,,,,if,,,,, ,,,,,FileExt,,,,, ,,,,,=,,,,, ,,,,,'.xls',,,,, ,,,,,then,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,ExportGrid4ToExcel(FileName,,,,,, ,,,,,Self.cxGrid1),,,,, ,,,,,
,,,,, ,,,,, ,,,,,else,,,,, ,,,,,if,,,,, ,,,,,FileExt,,,,, ,,,,,=,,,,, ,,,,,'.xml',,,,, ,,,,,then,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,ExportGrid4ToXML(FileName,,,,,, ,,,,,Self.cxGrid1),,,,, ,,,,,
,,,,, ,,,,, ,,,,,else,,,,, ,,,,,if,,,,, ,,,,,FileExt,,,,, ,,,,,=,,,,, ,,,,,'.txt',,,,, ,,,,,then,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,ExportGrid4ToText(FileName,,,,,, ,,,,,Self.cxGrid1),,,,, ,,,,,
,,,,, ,,,,, ,,,,,else,,,,, ,,,,,if,,,,, ,,,,,FileExt,,,,, ,,,,,=,,,,, ,,,,,'.html',,,,, ,,,,,then,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,ExportGrid4ToHTML(FileName,,,,,, ,,,,,Self.cxGrid1),,,,, ,,,,,
,,,,, ,,,,, ,,,,,else,,,,, ,,,,,
,,,,, ,,,,, ,,,,,begin,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,msg,,,,, ,,,,,:=,,,,, ,,,,,'不支持的导出文件类型...';,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,Application.MessageBox(PChar(msg),,,,,, ,,,,,PChar(Application.Title),,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,, ,,,,, ,,,,,MB_OK,,,,, ,,,,,or,,,,, ,,,,,MB_IconError);,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,Exit;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,end;,,,,, ,,,,,
,,,,, ,,,,,
,,,,, ,,,,, ,,,,,msg,,,,, ,,,,,:=,,,,, ,,,,,'导出完成...';,,,,, ,,,,,
,,,,, ,,,,, ,,,,,Application.MessageBox(PChar(msg),,,,,, ,,,,,PChar(Application.Title),,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,MB_OK,,,,, ,,,,,or,,,,, ,,,,,MB_IconInformation);,,,,, ,,,,,
,,,,,end;,,,,, ,,,,,
,,,,, ,,,,,
,,,,,procedure,,,,, ,,,,,TFormItemList.miPrintClick(Sender:,,,,, ,,,,,TObject);,,,,, ,,,,,
,,,,,begin,,,,, ,,,,,
,,,,, ,,,,, ,,,,,//打印,,,,, ,,,,,
,,,,, ,,,,, ,,,,,Self.dxComponentPrinter.Preview(True,,,,,, ,,,,,Self.dxComponentPrinterLink1);,,,,, ,,,,,
,,,,,end;,,,,, ,,,,,
,,,,, ,,,,,
,,,,,procedure,,,,, ,,,,,TFormItemList.cxGridPopupMenuPopup(ASenderMenu:,,,,, ,,,,,TComponent;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,AHitTest:,,,,, ,,,,,TcxCustomGridHitTest;,,,,, ,,,,,X,,,,,, ,,,,,Y:,,,,, ,,,,,Integer;,,,,, ,,,,,var,,,,, ,,,,,AllowPopup:,,,,, ,,,,,Boolean);,,,,, ,,,,,
,,,,,begin,,,,, ,,,,,
,,,,, ,,,,, ,,,,,if,,,,, ,,,,,GetHitTypeByHitCode(AHitTest.HitTestCode),,,,, ,,,,,=,,,,, ,,,,,gvhtColumnHeader,,,,, ,,,,,then,,,,,//右击列标题时,,,,, ,,,,,
,,,,, ,,,,, ,,,,,begin,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,//if,,,,, ,,,,,tvResult.DataController.Groups.GroupingItemCount,,,,, ,,,,,>,,,,, ,,,,,0,,,,, ,,,,,then,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,if,,,,, ,,,,,tvResult.GroupedColumnCount,,,,, ,,,,,>,,,,, ,,,,,0,,,,, ,,,,,then,,,,,//有分组时显示,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,begin,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,, ,,,,,TMenuItem(Self.FindComponent('miLineForGroup')).Visible,,,,, ,,,,,:=,,,,, ,,,,,True;,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,, ,,,,,TMenuItem(Self.FindComponent('miExpandAllGroup')).Visible,,,,, ,,,,,:=,,,,, ,,,,,True;,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,, ,,,,,TMenuItem(Self.FindComponent('miCollapseAllGroup')).Visible,,,,, ,,,,,:=,,,,, ,,,,,True;,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,end,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,else,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,begin,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,, ,,,,,TMenuItem(Self.FindComponent('miLineForGroup')).Visible,,,,, ,,,,,:=,,,,, ,,,,,False;,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,, ,,,,,TMenuItem(Self.FindComponent('miExpandAllGroup')).Visible,,,,, ,,,,,:=,,,,, ,,,,,False;,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,, ,,,,,TMenuItem(Self.FindComponent('miCollapseAllGroup')).Visible,,,,, ,,,,,:=,,,,, ,,,,,False;,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,end;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,end;,,,,, ,,,,,
,,,,,end;,,,,, ,,,,,
,,,,, ,,,,,
,,,,,procedure,,,,, ,,,,,TFormItemList.miFilterBuilderClick(Sender:,,,,, ,,,,,TObject);,,,,, ,,,,,
,,,,,begin,,,,, ,,,,,
,,,,, ,,,,, ,,,,,//过滤管理器,,,,, ,,,,,
,,,,, ,,,,, ,,,,,//弹出Filter,,,,, ,,,,,Builder,,,,, ,,,,,Dialog对话框,,,,, ,,,,,
,,,,, ,,,,, ,,,,,tvResult.Filtering.RunCustomizeDialog;,,,,, ,,,,,
,,,,,end;,,,,, ,,,,,
,,,,, ,,,,,
,,,,,procedure,,,,, ,,,,,TFormItemList.miCustomFilterClick(Sender:,,,,, ,,,,,TObject);,,,,, ,,,,,
,,,,,var,,,,, ,,,,,
,,,,, ,,,,, ,,,,,AHitTest:,,,,, ,,,,,TcxCustomGridHitTest;,,,,, ,,,,,
,,,,,begin,,,,, ,,,,,
,,,,, ,,,,, ,,,,,//自定义过滤,,,,, ,,,,,
,,,,, ,,,,, ,,,,,//弹出Custom,,,,, ,,,,,Filter,,,,, ,,,,,Dialog对话框,,,,, ,,,,,
,,,,, ,,,,, ,,,,,AHitTest,,,,, ,,,,,:=,,,,, ,,,,,cxGridPopupMenu.HitTest;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,if,,,,, ,,,,,GetHitTypeByHitCode(AHitTest.HitTestCode),,,,, ,,,,,=,,,,, ,,,,,gvhtColumnHeader,,,,, ,,,,,then,,,,,//获得右击的列,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,tvResult.Filtering.RunCustomizeDialog(TcxGridColumnHeaderHitTest(AHitTest).Column);,,,,, ,
,,,,
,,,,,end;,,,,, ,,,,,
,,,,, ,,,,,
,,,,,procedure,,,,, ,,,,,TFormItemList.miFilterPanelClick(Sender:,,,,, ,,,,,TObject);,,,,, ,,,,,
,,,,,var,,,,, ,,,,,
,,,,, ,,,,, ,,,,,mi:,,,,, ,,,,,TMenuItem;,,,,, ,,,,,
,,,,,begin,,,,, ,,,,,
,,,,, ,,,,, ,,,,,//隐藏/显示过滤面板,,,,, ,,,,,
,,,,, ,,,,, ,,,,,mi,,,,, ,,,,,:=,,,,, ,,,,,TMenuItem(Sender);,,,,, ,,,,,
,,,,, ,,,,, ,,,,,mi.Checked,,,,, ,,,,,:=,,,,, ,,,,,True;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,if,,,,, ,,,,,mi.Name,,,,, ,,,,,=,,,,, ,,,,,'miFilterPanelAlways',,,,, ,,,,,then,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,tvResult.Filtering.Visible,,,,, ,,,,,:=,,,,, ,,,,,fvAlways,,,,, ,,,,,
,,,,, ,,,,, ,,,,,else,,,,, ,,,,,if,,,,, ,,,,,mi.Name,,,,, ,,,,,=,,,,, ,,,,,'miFilterPanelNerver',,,,, ,,,,,then,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,tvResult.Filtering.Visible,,,,, ,,,,,:=,,,,, ,,,,,fvNever,,,,, ,,,,,
,,,,, ,,,,, ,,,,,else,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,tvResult.Filtering.Visible,,,,, ,,,,,:=,,,,, ,,,,,fvNonEmpty;,,,,, ,,,,,
,,,,,end;,,,,, ,,,,,
,,,,, ,,,,,
,,,,,procedure,,,,, ,,,,,TFormItemList.miExpandAllGroupClick(Sender:,,,,, ,,,,,TObject);,,,,, ,,,,,
,,,,,begin,,,,, ,,,,,
,,,,, ,,,,, ,,,,,//展开所有组,,,,, ,,,,,
,,,,, ,,,,, ,,,,,tvResult.DataController.Groups.FullExpand;,,,,, ,,,,,
,,,,,end;,,,,, ,,,,,
,,,,, ,,,,,
,,,,,procedure,,,,, ,,,,,TFormItemList.miCollapseAllGroupClick(Sender:,,,,, ,,,,,TObject);,,,,, ,,,,,
,,,,,begin,,,,, ,,,,,
,,,,, ,,,,, ,,,,,//收缩所有组,,,,, ,,,,,
,,,,, ,,,,, ,,,,,tvResult.DataController.Groups.FullCollapse;,,,,, ,,,,,
,,,,,end;,,,,, ,,,,,
,,,,,
此楼回复Re: ,,,,,
在用,留名
此楼回复Re: ,,,,,
技巧三,,,,, ,,,,,按条件计算合计值,,,,, ,,,,,
,,,,, ,,,,,
,,,,,在Footer的第一列显示[合计:],,,,, ,,,,,
,,,,,加一个Summary项,Column设为Grid的第一列,Kind设为skNone,,,,, ,,,,,
,,,,,在该Summary项的OnGetText事件中,输入:,,,,, ,,,,,
,,,,,procedure,,,,, ,,,,,TFormExpense.tvExpenseTcxGridDBDataControllerTcxDataSummaryFooterSummaryItems
2GetText(,,,,, ,,,,,
,,,,, ,,,,, ,,,,,Sender:,,,,, ,,,,,TcxDataSummaryItem;,,,,, ,,,,,const,,,,, ,,,,,AValue:,,,,, ,,,,,Variant;,,,,, ,,,,,AIsFooter:,,,,, ,
,,,,Boolean;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,var,,,,, ,,,,,AText:,,,,, ,,,,,String);,,,,, ,,,,,
,,,,,begin,,,,, ,,,,,
,,,,, ,,,,, ,,,,,AText,,,,, ,,,,,:=,,,,, ,,,,,'合计:';,,,,, ,,,,,
,,,,,end;,,,,, ,,,,,
,,,,, ,,,,,
,,,,,按条件汇总:,,,,, ,,,,,
,,,,,在TableView的DataController->Summary->FooterSummary->OnSummary事件中,输入:,,,,, ,,,,,
,,,,,procedure,,,,, ,,,,,TFormExpense.tvExpenseDataControllerSummaryFooterSummaryItemsSummary(,,,,, ,,,,,
,,,,, ,,,,, ,,,,,ASender:,,,,, ,,,,,TcxDataSummaryItems;,,,,, ,,,,,Arguments:,,,,, ,,,,,TcxSummaryEventArguments;,,,,, ,,
,,,
,,,,, ,,,,, ,,,,,var,,,,, ,,,,,OutArguments:,,,,, ,,,,,TcxSummaryEventOutArguments);,,,,, ,,,,,
,,,,,begin,,,,, ,,,,,
,,,,, ,,,,, ,,,,,//得到字段名,,,,, ,,,,,TcxDBDataSummaryItem(Arguments.SummaryItem).FieldName;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,if,,,,, ,,,,,(ASender.DataController.Values[Arguments.RecordIndex,,,,,, ,,,,,tvExpenseLevel.Index],,,,, ,,,
,,>,,,,, ,,,,,1),,,,, ,,,,, ,,,,, ,,,,,//只统计Level列=1的值,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,and,,,,, ,,,,,(TcxDBDataSummaryItem(Arguments.SummaryItem).Kind,,,,, ,,,,,=,,,,, ,,,,,skSum),,
,,, ,,,,,then,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,OutArguments.Value,,,,, ,,,,,:=,,,,, ,,,,,0;,,,,,//Level,,,,, ,,,,,>,,,,, ,,,,,1的统计值设为0,,,,, ,,,,,
,,,,,end;,,,,, ,,,,,
,,,,,
此楼回复Re: ,,,,,
借贵地一用,问个CXGrid问题,在cxgrid中如何使一些行不能编辑,如:字段isenable,,,,, ,,,,,=,,,,, ,,,,,false的行
此楼回复Re: ,,,,,
楼上的问题,,,,, ,,,,,
,,,,,请参考下面的技巧,,,,, ,,,,,
,,,,, ,,,,,
,,,,,技巧四:根据某列的值设定其它列的可编辑性,,,,, ,,,,,
,,,,, ,,,,,
,,,,,procedure,,,,, ,,,,,TFormUser.tvUserEditing(Sender:,,,,, ,,,,,TcxCustomGridTableView;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,AItem:,,,,, ,,,,,TcxCustomGridTableItem;,,,,, ,,,,,var,,,,, ,,,,,AAllow:,,,,, ,,,,,Boolean);,,,,, ,,,,,
,,,,,begin,,,,, ,,,,,
,,,,, ,,,,, ,,,,,//如果第三列值为True,则第4列不能修改,,,,, ,,,,,
,,,,, ,,,,, ,,,,,if,,,,, ,,,,,(tvUser.Controller.FocusedRecord.Values[2],,,,, ,,,,,=,,,,, ,,,,,True),,,,, ,,,,,and,,,,, ,,,,,(AItem.Index,,,,, ,,,,,=,,,,, ,,,,,4),,,,, ,,,,,then,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,AAllow,,,,, ,,,,,:=,,,,, ,,,,,False,,,,, ,,,,,
,,,,, ,,,,, ,,,,,else,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,AAllow,,,,, ,,,,,:=,,,,, ,,,,,True;,,,,, ,,,,,
,,,,,end;,,,,, ,,,,,
,,,,,
此楼回复Re: ,,,,,
技巧五:保存/恢复Grid布局,,,,, ,,,,,
,,,,, ,,,,,
,,,,,//恢复布局,,,,, ,,,,,
,,,,,IniFileName,,,,, ,,,,,:=,,,,, ,,,,,ExtractFilePath(Application.ExeName),,,,, ,,,,,+,,,,, ,,,,,'Layout\',,,,, ,,,,,+,,,,, ,,,,,Self.Name,,,,, ,,,,,+,,,,, ,,,,,'.ini';,,,,, ,,,,,
,,,,,if,,,,, ,,,,,FileExists(IniFileName),,,,, ,,,,,then,,,,, ,,,,,
,,,,, ,,,,, ,,,,,Self.tvResult.RestoreFromIniFile(IniFileName),,,,,//从布局文件中恢复,,,,, ,,,,,
,,,,,else,,,,, ,,,,,
,,,,,begin,,,,, ,,,,,
,,,,, ,,,,, ,,,,,Self.tvResult.BeginUpdate;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,for,,,,, ,,,,,i,,,,, ,,,,,:=,,,,, ,,,,,0,,,,, ,,,,,to,,,,, ,,,,,Self.tvResult.ItemCount,,,,, ,,,,,-,,,,, ,,,,,1,,,,, ,,,,,do,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,Self.tvResult.Items[i].ApplyBestFit;,,,,,//调整为最佳宽度,,,,, ,,,,,
,,,,, ,,,,, ,,,,,Self.tvResult.EndUpdate;,,,,, ,,,,,
,,,,,end;,,,,, ,,,,,
,,,,, ,,,,,
,,,,,//保存布局,,,,, ,,,,,
,,,,,IniFileName,,,,, ,,,,,:=,,,,, ,,,,,ExtractFilePath(Application.ExeName),,,,, ,,,,,+,,,,, ,,,,,'Layout\',,,,, ,,,,,+,,,,, ,,,,,Self.Name,,,,, ,,,,,+,,,,, ,,,,,'.ini';,,,,, ,,,,,
,,,,,if,,,,, ,,,,,not,,,,, ,,,,,DirectoryExists(ExtractFileDir(IniFileName)),,,,, ,,,,,then,,,,, ,,,,,
,,,,, ,,,,, ,,,,,CreateDir(ExtractFileDir(IniFileName));,,,,, ,,,,,
,,,,,Self.tvResult.StoreToIniFile(IniFileName);,,,,,//保存为布局文件,,,,, ,,,,,
,,,,,
此楼回复Re: ,,,,,
借用地问一下:在,,,,, ,,,,,cxgrid中,如果我同时选中主表与子表中的记录,怎幺样能同时进行对其所选记录进行处理呢。,,,,, ,,,,,
,,,,,我现在只能判断,,,,, ,,,,,焦点是在主表还是从表中,然后只能对主表或子表中的数据进行处理。,,,,, ,,,,,
,,,,,
此楼回复Re: ,,,,,
看来用cxGrid人不多啊,,,,, ,,,,,
,,,,, ,,,,,
,,,,,再多贴一些技巧,需要的朋友顶一下,,,,, ,,,,,
,,,,, ,,,,,
,,,,,==========================================================================,,,,, ,,,,,
,,,,, ,,,,,
,,,,,在主从TableView中根据主TableView得到对应的从TableView,,,,, ,,,,,
,,,,,var,,,,, ,,,,,
,,,,, ,,,,, ,,,,,ADetailDC:,,,,, ,,,,,TcxGridDataController;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,AView:,,,,, ,,,,,TcxCustomGridTableView;,,,,, ,,,,,
,,,,,begin,,,,, ,,,,,
,,,,, ,,,,, ,,,,,with,,,,, ,,,,,cxGrid1DBTableView1.DataController,,,,, ,,,,,do,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,ADetailDC,,,,, ,,,,,:=,,,,, ,,,,,TcxGridDataController(GetDetailDataController(FocusedRecordInd
ex,,,,,, ,,,,,0));,,,,, ,,,,,
,,,,, ,,,,, ,,,,,AView,,,,, ,,,,,:=,,,,, ,,,,,ADetailDC.GridView;,,,,, ,,,,,
,,,,,end;,,,,, ,,,,,
,,,,, ,,,,,
,,,,,==============================================================================,,,,, ,,
,,,
,,,,, ,,,,,
,,,,,定位在第一行并显示内置编辑器,,,,, ,,,,,
,,,,, ,,,,,
,,,,,cxDBVerticalGrid1.FocusedRow,,,,, ,,,,,:=,,,,, ,,,,,cxDBVerticalGrid1.Rows[0];,,,,, ,,,,,
,,,,,cxDBVerticalGrid1.ShowEdit;,,,,, ,,,,,
,,,,, ,,,,,
,,,,,==============================================================================,,,,, ,,
,,,
,,,,, ,,,,,
,,,,,隐藏,,,,, ,,,,,"
",,,,, ,,,,,字符串,,,,, ,,,,,
,,,,, ,,,,,
,,,,,该文本存储在scxGridNoDataInfoText资源字符串,可以将该资源字符串的内容设为空,,,,, ,,,,,
,,,,,来隐藏该文本。,,,,, ,,,,,
,,,,, ,,,,,
,,,,,uses,,,,, ,,,,,cxClasses,,,,,, ,,,,,cxGridStrs;,,,,, ,,,,, ,,,,,
,,,,, ,,,,, ,,,,,...,,,,, ,,,,,
,,,,, ,,,,, ,,,,,cxSetResourceString(@scxGridNoDataInfoText,,,,,, ,,,,,'');,,,,, ,,,,,
,,,,, ,,,,,
,,,,, ,,,,, ,,,,,//如果"",,,,, ,,,,,字符串已经显示,需要调用:,,,,, ,,,,,
,,,,, ,,,,, ,,,,,.LayoutChanged;,,,,, ,,,,,
,,,,, ,,,,,
,,,,,============================================================,,,,, ,,,,,
,,,,, ,,,,,
,,,,,删除应用过滤后的行,,,,, ,,,,,
,,,,, ,,,,,
,,,,,var,,,,, ,,,,,
,,,,, ,,,,, ,,,,,I:,,,,, ,,,,,Integer;,,,,, ,,,,,
,,,,,begin,,,,, ,,,,,
,,,,, ,,,,, ,,,,,with,,,,, ,,,,,,,,,, ,,,,,do,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,for,,,,, ,,,,,I,,,,, ,,,,,:=,,,,, ,,,,,0,,,,, ,,,,,to,,,,, ,,,,,ViewData.RecordCount,,,,, ,,,,,-,,,,, ,,,,,1,,,,, ,,,,,do,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,begin,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,, ,,,,, ,,,,,ViewData.Records[0].Focused,,,,, ,,,,,:=,,,,, ,,,,,True;,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,, ,,,,, ,,,,,DataController.DataSet.Delete;,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,end;,,,,, ,,,,,
,,,,, ,,,,,
,,,,,=============================================================,,,,, ,,,,,
,,,,, ,,,,,
,,,,,根据单元的值设置样式,,,,, ,,,,,
,,,,, ,,,,,
,,,,,procedure,,,,, ,,,,,.StylesGetContentStyle(,,,,, ,,,,,
,,,,, ,,,,, ,,,,,Sender:,,,,, ,,,,,TcxCustomGridTableView;,,,,, ,,,,,ARecord:,,,,, ,,,,,TcxCustomGridRecord;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,AItem:,,,,, ,,,,,TcxCustomGridTableItem;,,,,, ,,,,,out,,,,, ,,,,,AStyle:,,,,, ,,,,,TcxStyle);,,,,, ,,,,,
,,,,,begin,,,,, ,,,,,
,,,,, ,,,,, ,,,,,if,,,,, ,,,,,ARecord.Values[AItem.Index],,,,, ,,,,,=,,,,, ,,,,,aSomeValue,,,,, ,,,,,then,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,AStyle,,,,, ,,,,,:=,,,,, ,,,,,;,,,,, ,,,,,
,,,,,end;,,,,, ,,,,,
,,,,, ,,,,,
,,,,,procedure,,,,, ,,,,,.StylesGetContentStyle(,,,,, ,,,,,
,,,,, ,,,,, ,,,,,Sender:,,,,, ,,,,,TcxCustomGridTableView;,,,,, ,,,,,ARecord:,,,,, ,,,,,TcxCustomGridRecord;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,AItem:,,,,, ,,,,,TcxCustomGridTableItem;,,,,, ,,,,,out,,,,, ,,,,,AStyle:,,,,, ,,,,,TcxStyle);,,,,, ,,,,,
,,,,,var,,,,, ,,,,,
,,,,, ,,,,, ,,,,,AColumn:,,,,, ,,,,,TcxCustomGridTableItem;,,,,, ,,,,,
,,,,,begin,,,,, ,,,,,
,,,,, ,,,,, ,,,,,AColumn,,,,, ,,,,,:=,,,,, ,,,,,(Sender,,,,, ,,,,,as,,,,, ,,,,,TcxGridDBTableView).GetColumnByFieldName('E
mail');,,,,, ,,,,,
,,,,, ,,,,, ,,,,,if,,,,, ,,,,,VarToStr(ARecord.Values[AColumn.Index]),,,,, ,,,,,=,,,,, ,,,,,'',,,,, ,,,,,then,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,AStyle,,,,, ,,,,,:=,,,,, ,,,,,cxStyleNullEmail;,,,,, ,,,,,
,,,,,end;,,,,, ,,,,,
,,,,, ,,,,,
,,,,,==============================================================================,,,,, ,,,,,
,,,,, ,,,,,
,,,,,TcxCustomGridTableView.FindItemByName,,,,,, ,,,,,TcxGridDBTableView.GetColumnByFieldName,,,,, ,,,,,or,,,,, ,,,,,
,,,,,TcxGridDBDataController.GetItemByFieldName,,,,, ,,,,,
,,,,, ,,,,,
,,,,, ,,,,, ,,,,,with,,,,, ,,,,,cxGrid1DBBandedTableView1.DataController,,,,, ,,,,,do,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,AValue,,,,, ,,,,,:=,,,,, ,,,,,Values[FocusedRecordIndex,,,,,, ,,,,,GetItemByFieldName('SomeField
Name').Index];,,,,, ,,,,,
,,,,, ,,,,,
,,,,,===================================================================,,,,, ,,,,,
,,,,, ,,,,,
,,,,,动态生成BandedView,,,,, ,,,,,
,,,,, ,,,,,
,,,,,var,,,,, ,,,,,
,,,,, ,,,,, ,,,,,AView:,,,,, ,,,,,TcxCustomGridView;,,,,, ,,,,,
,,,,,begin,,,,, ,,,,,
,,,,, ,,,,, ,,,,,AView,,,,, ,,,,,:=,,,,, ,,,,,.CreateView(TcxGridDBBandedTableView);,,,,, ,,,,,
,,,,, ,,,,, ,,,,,TcxGridDBBandedTableView(AView).DataController.DataSource,,,,, ,,,,,:=,,,,, ,,,,,;,,,,, ,,,
,,
,,,,, ,,,,, ,,,,,TcxGridDBBandedTableView(AView).Bands.Add;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,with,,,,, ,,,,,TcxGridDBBandedTableView(AView).Bands.Add,,,,, ,,,,,do,,,,, ,,,,,
,,,,, ,,,,, ,,,,,begin,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,Visible,,,,, ,,,,,:=,,,,, ,,,,,False;,,,,, ,,,,,
,,,,, ,,,,, ,,,,, ,,,,, ,,,,,FixedKind,,,,, ,,,,,:=,,,,, ,,,,,fkLeft;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,end;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,TcxGridDBBandedTableView(AView).DataController.CreateAllItems;,,,,, ,,,,,
,,,,, ,,,,, ,,,,,.GridView,,,,, ,,,,,:=,,,,, ,,,,,AView;,,,,, ,,,,,
,,,,,
此楼回复Re: ,,,,,
======================================================================,,,,, ,,,,,
,,,,, ,,,,,
,,,,,当底层数据集为空时显示一条空记录,,,,, ,,,,,
,,,,, ,,,,,
,,,,,procedure,,,,, ,,,,,