




已阅读5页,还剩43页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
object cxDBF_TestType: TcxDBLookupComboBox Left = 85 Top = 50 AutoSize = False DataBinding.DataField = TestType DataBinding.DataSource = dmTest.ds_Test Properties.DropDownListStyle = lsFixedList Properties.ImmediatePost = True Properties.KeyFieldNames = TestTypeTbID Properties.ListColumns = Properties.ListOptions.ShowHeader = False Properties.ListSource = dmTest.ds_TestTypeTb Style.LookAndFeel.Kind = lfOffice11 Style.LookAndFeel.SkinName = Lilian StyleDisabled.LookAndFeel.Kind = lfOffice11 StyleDisabled.LookAndFeel.SkinName = Lilian StyleFocused.LookAndFeel.Kind = lfOffice11 StyleFocused.LookAndFeel.SkinName = Lilian StyleHot.LookAndFeel.Kind = lfOffice11 StyleHot.LookAndFeel.SkinName = Lilian TabOrder = 3 Height = 22 Width = 140 endcxGrid控件的应用方法var i: Integer; FieldName,DisplayName: string; FColumn: TcxGridDBColumn;for i := 0 to AdoTable1.Fields.Count - 1 do begin FieldName := AdoTable1.Fieldsi.FieldName; AdoTable1.Fieldsi.DisplayLabel := FieldName; FColumn := cxGridDBTableView.CreateColumn; FColumn.DataBinding.FieldName := FieldName; FColumn.MinWidth := 100; end; end; 另一种方法:procedure TForm1.btnAddRowColumnClick(Sender: TObject); var Column: TcxGridColumn; begin Column:= cxGrid1TableView1.CreateColumn; Column.Caption := Test; cxGrid1TableView1.DataController.AppendRecord; cxGrid1TableView1.DataController.Values0, 0 := ABC; cxGrid1TableView1.DataController.Post; end; procedure TForm1.btnDelRowColumnClick(Sender: TObject); begin cxGrid1TableView1.DataController.DeleteRecord(0); cxGrid1TableView1.Columns0.Free; end; 最近做了Cxgrid的加强右键菜单工具 新版本已出来,加入了多语控制等功能,优化了速度(希望大家给点意见) 主要功能:(详情请下载后运行其中的cxGridPopupMenuTest.exe文件) 1.多列排序 2.对列进行計數、合計、求最大值、求最小值、求平均值的聚合操作 3.设置列的对齐方式:居中、居左、居右 4.将数据输出到EXCEL、HTML、XML、TEXT 5.过滤数据 6.选择隐藏列 7.图形分析(将直接数据或分组后的数据用条图、屏图等多种图形显示出来) 8.增删改表头操作,也可设置表头的位置 9.增删改非数据关联列的操作,可定义计算列的取值脚本 10.配色设置(可选择统一配色或根据列或记录的值自定义列或行的颜色) 11.打印设置(可打印当前的cxGrid或其它此窗体上的控件) 12.多语功能 13.其它(如加入序号列、块选择数据、使过滤数据在Dataset上也起作用) 如果你有新的需求或更改的地放,请联系,谢谢 所有介绍中的设置都会自动保存,下次打开窗体时会自动加载上次的设置。 联系方式QQ:16187001 SKYPE: , 主页: 预览地址 /file/view.bmp 下载地址: /file/test.rarcxgrid:cxgrid如何框选表中的数据?cxgrid里已经是多选 但选择时候只能有鼠标+ctrl或是头选下,然后shift选尾 能不能用框选的,就是用鼠标按住拖动进行多选? 怎么设置呀? cxGird里面通常有个cxView,需要设置其OptionsSelectionCellMultiSelect为True3Q 原来我是打勾MultiSelect cxgrid取某一个列的求和的值,怎么读取?在CXGRID中,已经对某一列在footerkind设置了求和skSum, 我Label.caption:这个列的求和? 要怎么读取啊?统计功能 解决:cxGrid1DBTableView1-optionsview-Footer 设为True cxGrid1DBTableView1-DataController-Summary设置FooterSummaryItems即可 可以在那一列的OnCustomDrawFooterCell事件里面写: Label.Caption:=AViewInfo.Text;获得总计项目 var AItem: TcxDataSummaryItem; begin AItem := .DataController.Summary.FooterSummaryItems.ItemOfItemLink(); AItem := .DataController.Summary.DefaultGroupSummaryItems.ItemOfItemLink(); procedure TForm1.cxGrid1DBTableView1DataControllerSummaryAfterSummary( ASender: TcxDataSummary); V1 := ASender.FooterSummaryValuesASender.FooterSummaryItems.IndexOfItemLink(cxGrid1DBTableView1CustNo); V2 := ASender.FooterSummaryValuesASender.FooterSummaryItems.IndexOfItemLink(cxGrid1DBTableView1Addr1); DevExpress的TcxDBLookupComboBox使用方法及问题DevExpress的TcxDBLookupComboBox使用方法及问题如题。 首先,使用方法不会,请各位不吝赐教。谢谢 其次,问题。TcxDBLookupComboBox具体属性设置:DataSource=S1 , DataBinding.DataField=A , Properties.ListSource=S2 , Properties.KeyFieldName=A , Properties.ListFieldIndex=0 , Properties.ListFieldName=B , Properties.ListColumns只包含B , S1和S2为一样的数据集,但不是同一个。 在这样的设置情况下,当Properties.GridMode设置为TRUE时,编译通过,运行时错误但是错误提示太简单。为什么会发生错误? 当Properties.GridMode设置为FALSE时,编译通过,运行时无错误。且显示正确即可以显示数据集的所有记录。但是选择条目时无效,即无法选择,无论选择什么条目结果都是同一个条目(第一个)。为什么? 一直等待。谢谢 例子看了,明白了点。测试也通过了。不过和我的本意还是不一样。 也许组件选择错了。 我是想这样:表A包含A1,A2字段,A1为数据,A2为显示。用LookupComboBox显示A2,当选择不同A2时获取相应的A1。 DevExpress才刚刚接触,所以很多不明白的。该选择哪个组件?请赐教。谢谢问题解决。结帖。 共享:Self.cxLCB_MCL.EditValue为当前KeyFieldNames的值。cxgrid:cxgrid band功能的实现。?谁用过cxgrid,问个错误orBug,不知人家是怎么实现的,谢大家. cxgrid 那个band功能怎么实现?就是一条数据的可能是第一行,占了两行或是三行的数据位. 用BandView,然后就可以加band了,调整Band的FixKind就可以冻结属于该Band的列 小菜说的不是Band的功能吧?貌似是Preview? BAND主要是就实现多表头的功能 不是那意思,是指数据行, 山西省,11,111,111 山西省,22,222,222 山西省,33,333,333 山东省 河南省 河北省 下面的省一样,我想让第一列只出现一次省份,理解了? 相当于第一列的行占许多行. 这样呀,那还真没遇到过:( 不清楚自代的实例中是否有这样的Method,可以去看看 实例中有,但我不知人家是怎么实现的,不知是改了哪的属性了,也没搞理解. 那是分组啊,按省”分组就可以了 把分组框弄出来,然后把省”拖上去就可以了cxgrid中动态查询问题.cxgrid中某字段(如下的商品字段)设置为lookupcombobox其listsoure是通过数据源连clientdataset 获得,而clientdataset的commandtext查询语句是在程序中动态指定的(通过选择商品类别后作为条件,查询出该类别下的所有商品),这样出现一个问题比如: ID 商品类别 商品 规格 . 1 RD01 笔记本 . 2 GM01 适配卡 . . 在商品lookupcombobox相关事件下有如下代码: sp:=cd_stdata.FieldByName(商品类别).Asstring; if sp then begin cd_gdxc.CommandText:=select 商品 from 商品 where 商品类别=+sp+; cd_gdxc.Open; end; 问题:在第一条记录单击商品时调用以上事件找出商品类别为RD01的所有商品,这里选择了笔记本 而当移到第二条记录选择商品时调用以上事件应需要重新查询,所以第一条记录的商品名称就失去了,怎样才能保持不影响之前的商品,因为用的是clientdataset不知怎么解决该类问题。,该问题不好描述,望有类似经验高手指教!DevExpress部分使用技巧(转存) - 轻舞肥羊 1.扩展cxLookupComboBox,使其支持多列查询的cxLookupComboBoxEx/=/ Unit Name: cxLookupComboBoxEx/ Author : ysai/ Date : 2003/ Purpose : 扩展cxLookupComboBox,cxDBLookupComboBox,使其支持多列过滤/ History :/ 2003-05-28大数据量改进/ 2003-07-07可操作性改进/ 2003-08-20效率改进/ 2003-08-29加入过滤延时/ 注意:/ 限制1,不能再使用Properties.OnChange事件/ 限制2,不能再使用Properties.ListSource.DataSet.OnFilterRecord事件/ 限制3,不能再使用Properties.ListSource.DataSet.Filtered属性/ 其它,最好在设计期设好一切属性,运行期再设置属性可能引发求知错误/=unit cxLookupComboBoxEx;interfaceuses SysUtils, Classes, Controls, Windows, Messages,DB,StrUtils, cxControls, cxContainer, cxEdit, cxTextEdit, cxMaskEdit, cxDropDownEdit, cxLookupEdit, cxDBLookupEdit, cxDBLookupComboBox;type TcxLookupComboBoxEx = class(TcxLookupComboBox) private /保存要过滤的字段列表 FFieldList : TList; FFindText : String; /过滤事件 procedure _OnFilterRecord(DataSet: TDataSet; var Accept: Boolean); /编辑框文字改变事件 procedure _OnChange(Sender : TObject); procedure GetFieldList; /延时过滤消息 procedure WMTimer (var Message: TMessage); message WM_TIMER; protected /下拉表格收回时 procedure CloseUp(AAccept: Boolean); override; /过滤过程 procedure _FilterListSource; /初始化下拉表格事件 procedure DoInitPopup; override; public constructor Create(AOwner : TComponent); override; destructor Destroy; override; /更新要过滤的字段列表 procedure UpdateFilterFields; published end; TcxDBLookupComboBoxEx = class(TcxDBLookupComboBox) private /保存要过滤的字段列表 FFieldList : TList; FFindText : String; /过滤事件 procedure _OnFilterRecord(DataSet: TDataSet; var Accept: Boolean); /编辑框文字改变事件 procedure _OnChange(Sender : TObject); /取得要过滤的字段列表 procedure GetFieldList; /延时过滤消息 procedure WMTimer (var Message: TMessage); message WM_TIMER; protected /下拉表格收回时 procedure CloseUp(AAccept: Boolean); override; /过滤过程 procedure _FilterListSource; /初始化下拉表格事件 procedure DoInitPopup; override; public constructor Create(AOwner : TComponent); override; destructor Destroy; override; /更新要过滤的字段列表 procedure UpdateFilterFields; published end;procedure Register;implementationconst UM_TIMER_FILTER = WM_USER + $101; /自定义延时消息ID FILTERTIMER = 500; /延时时间 DROPDOWN_ROWS = 12;procedure Register;begin RegisterComponents(Dev Express, TcxLookupComboBoxEx,TcxDBLookupComboBoxEx);end; TcxLookupComboBoxEx procedure TcxLookupComboBoxEx.CloseUp(AAccept: Boolean);begin inherited; /收起下拉后取消过滤 if Assigned(Properties.ListSource) then if Assigned(Properties.ListSource.DataSet) then Properties.ListSource.DataSet.Filtered := False;end;constructor TcxLookupComboBoxEx.Create(AOwner: TComponent);begin inherited; /默认值 Properties.AutoSelect := False; Properties.DropDownAutoSize := True; Properties.DropDownListStyle := lsEditList; Properties.DropDownRows := DROPDOWN_ROWS; Properties.DropDownSizeable := True; Properties.IncrementalFiltering := False; Properties.Revertable := True; Properties.OnChange := _OnChange; Properties.UseLeftAlignmentOnEditing := False;end;destructor TcxLookupComboBoxEx.Destroy;begin /释放过滤字段列表 if Assigned(FFieldList) then FFieldList.Free; inherited;end;procedure TcxLookupComboBoxEx.DoInitPopup;begin /取得过滤字段 if Assigned(Properties.ListSource) then if Assigned(Properties.ListSource.DataSet) then begin GetFieldList; Properties.ListSource.DataSet.Filtered := False; end; inherited DoInitPopup;end;procedure TcxLookupComboBoxEx._FilterListSource;/过滤字段begin if Assigned(Properties.ListSource) and Assigned(Properties.ListSource.DataSet) then try Properties.ListSource.DataSet.DisableControls; Properties.ListSource.DataSet.Filtered := False; Properties.ListSource.DataSet.OnFilterRecord := _OnFilterRecord; if Text then begin FFindText := Text; if SelLength 0 then FFindText := LeftStr(Text,SelStart); Properties.ListSource.DataSet.Filtered := FFindText ; end; Changed; finally Properties.ListSource.DataSet.EnableControls; end;end;procedure TcxLookupComboBoxEx.GetFieldList;/取得过滤字段列表var i : Integer; sFieldName : String; fdTemp : TField;begin if not Assigned(FFieldList) then begin FFieldList := TList.Create; for i:=0 to Properties.ListColumns.Count -1 do begin sFieldName := Properties.ListColumns.Itemsi.FieldName; if sFieldName = then Continue; fdTemp := Properties.ListSource.DataSet.FindField(sFieldName); if Assigned(fdTemp) then FFieldList.Add(Pointer(fdTemp); end; end;end;procedure TcxLookupComboBoxEx._OnChange(Sender: TObject);/设置延时begin if Focused and DroppedDown then begin KillTimer(Handle,UM_TIMER_FILTER); SetTimer(Handle,UM_TIMER_FILTER,FILTERTIMER,nil); end;end;procedure TcxLookupComboBoxEx._OnFilterRecord(DataSet: TDataSet; var Accept: Boolean);/过滤事件var s : String; i : Integer;begin s := LowerCase(FFindText); if (s ) and (Properties.ListColumns.Count 0) then begin Accept := False; for i := 0 to FFieldList.Count -1 do begin Accept := Pos(s,LowerCase(TField(FFieldListi).AsString)0; if Accept then Exit; end; end else Accept := True;end;procedure TcxLookupComboBoxEx.WMTimer(var Message: TMessage);/延时更新消息begin KillTimer(Handle,UM_TIMER_FILTER); if Focused and DroppedDown then _FilterListSource;end;procedure TcxLookupComboBoxEx.UpdateFilterFields;/更新要过滤的字段列表begin if Assigned(FFieldList) then begin FFieldList.Free; FFieldList := nil; end; GetFieldList;end; TcxDBLookupComboBoxEx procedure TcxDBLookupComboBoxEx.CloseUp(AAccept: Boolean);begin inherited; /收起下拉后取消过滤 if Assigned(Properties.ListSource) then if Assigned(Properties.ListSource.DataSet) then Properties.ListSource.DataSet.Filtered := False;end;constructor TcxDBLookupComboBoxEx.Create(AOwner: TComponent);begin inherited; /默认值 Properties.AutoSelect := False; Properties.DropDownListStyle := lsEditList; Properties.DropDownRows := DROPDOWN_ROWS; Properties.DropDownSizeable := True; Properties.IncrementalFiltering := False; Properties.Revertable := True; Properties.OnChange := _OnChange; Properties.UseLeftAlignmentOnEditing := False;end;destructor TcxDBLookupComboBoxEx.Destroy;begin /释放过滤字段列表 if Assigned(FFieldList) then FFieldList.Free; inherited;end;procedure TcxDBLookupComboBoxEx.DoInitPopup;begin /取得过滤字段 if Assigned(Properties.ListSource) then if Assigned(Properties.ListSource.DataSet) then begin GetFieldList; Properties.ListSource.DataSet.Filtered := False; end; inherited DoInitPopup;end;procedure TcxDBLookupComboBoxEx._FilterListSource;/过滤字段begin if Assigned(Properties.ListSource) and Assigned(Properties.ListSource.DataSet) then try Properties.ListSource.DataSet.DisableControls; Properties.ListSource.DataSet.Filtered := False; Properties.ListSource.DataSet.OnFilterRecord := _OnFilterRecord; if Text then begin FFindText := Text; if SelLength 0 then FFindText := LeftStr(Text,SelStart); Properties.ListSource.DataSet.Filtered := FFindText ; end; Changed; finally Properties.ListSource.DataSet.EnableControls; end;end;procedure TcxDBLookupComboBoxEx.GetFieldList;/取得过滤字段列表var i : Integer; sFieldName : String; fdTemp : TField;begin if not Assigned(FFieldList) then begin FFieldList := TList.Create; for i:=0 to Properties.ListColumns.Count -1 do begin sFieldName := Properties.ListColumns.Itemsi.FieldName; if sFieldName = then Continue; fdTemp := Properties.ListSource.DataSet.FindField(sFieldName); if Assigned(fdTemp) then FFieldList.Add(Pointer(fdTemp); end; end;end;procedure TcxDBLookupComboBoxEx._OnChange(Sender: TObject);/设置延时begin if Focused and DroppedDown then begin KillTimer(Handle,UM_TIMER_FILTER); SetTimer(Handle,UM_TIMER_FILTER,FILTERTIMER,nil); end;end;procedure TcxDBLookupComboBoxEx._OnFilterRecord(DataSet: TDataSet; var Accept: Boolean);/过滤事件var s : String; i : Integer;begin s := LowerCase(FFindText); if (s ) and (Properties.ListColumns.Count 0) then begin Accept := False; for i := 0 to FFieldList.Count -1 do begin Accept := Pos(s,LowerCase(TField(FFieldListi).AsString)0; if Accept then Exit; end; end else Accept := True;end;procedure TcxDBLookupComboBoxEx.WMTimer(var Message: TMessage);/延时更新消息begin KillTimer(Handle,UM_TIMER_FILTER); if Focused and DroppedDown then _FilterListSource;end;procedure TcxDBLookupComboBoxEx.UpdateFilterFields;/更新要过滤的字段列表begin if Assigned(FFieldList) then begin FFieldList.Free; FFieldList := nil; end; GetFieldList;end;end. 2004-1-10 17:14:06 2.动态生成TcxGridDBTableView的列及页脚的合计栏var i : Integer; cl : TcxGridDBColumn;begin Screen.Cursor := crHourGlass; cxtvMaster.BeginUpdate; try cxtvMaster.ClearItems; cxtvMaster.DataController.Summary.FooterSummaryItems.Clear; for i := 0 to cxtvMaster.DataController.DataSet.FieldCount - 1 do begin cl := cxtvMaster.CreateColumn; cl.DataBinding.FieldName := cxtvMaster.DataController.DataSet.Fieldsi.FieldName; if cxtvMaster.DataController.DataSet.Fieldsi is TNumericField then begin TNumericField(cxtvMaster.DataController.DataSet.Fieldsi) .DisplayFormat := #,#0.00; cl.Width := 80; with TcxGridDBTableSummaryItem( cxtvMaster.DataController.Summary.FooterSummaryItems.Add) do begin Column := cl; FieldName := cl.DataBinding.FieldName; Format := #,#0.00; Kind := skSum; end; end else if cxtvMaster.DataController.DataSet.Fieldsi is TStringField then cl.Width := 100 else cl.Width := 80; cl.HeaderAlignmentHorz := taCenter; end; /if finally cxtvMaster.EndUpdate; Screen.Cursor := crDefault; end;end; 2004-1-10 17:24:3
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 仓储与运输服务合同集及信息化解决方案
- 2025年综合类-内科住院医师-急诊科历年真题摘选带答案(5卷单选题百道集合)
- 2025年综合类-保险公估人考试-财产保险实务历年真题摘选带答案(5卷单选100题合辑)
- 2025年综合类-临床医学检验技术(士)-血型和输血历年真题摘选带答案(5套单选100题合辑)
- 2025年综合类-临床医学检验技术(士)-临床血液学检验综合练习历年真题摘选带答案(5套单选100题合辑)
- 2025年综合类-中西医结合执业医师-临床答辩-临床答辩综合练习历年真题摘选带答案(5卷单选100题合辑)
- 2025年综合类-中西医结合主治医师-消化系统疾病历年真题摘选带答案(5卷单选题百道集合)
- 2025年综合类-中级水路运输-国际航运融资历年真题摘选带答案(5卷单选100题合辑)
- 2025年综合类-中学教育心理学-第四章学习动机历年真题摘选带答案(5套单选100题合辑)
- 2025年综合类-中医骨伤科住院医师-普外科历年真题摘选带答案(5卷单选题百道集合)
- 村级维稳应急预案
- 2023年上海科学院招考笔试参考题库(共500题)答案详解版
- 2023年下半年浙江温州苍南县事业单位选调工作人员笔试参考题库(共500题)答案详解版
- 上海初一新生分班(摸底)语文考试模拟试卷(10套试卷带答案解析)
- (2023版)小学语文一年级上册电子课本
- 新华镇生活污水处理管网与新华农场管网并网项目环境影响报告表
- 人教版八年级上册数学全册同步讲义
- 乙醇酸安全技术说明书(msds)
- 《旅游学概论》第七章
- 矿用风动风机风机说明书
- 旅游规划资料清单
评论
0/150
提交评论