




已阅读5页,还剩3页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
XPTable的使用方法下载XPTable提供示例:下载当我们使用C#开发Windows应用程序,通常都用到DataGridView控件,毫无疑问,DataGrideView控件只提供了一些基本能满足我们使用的功能,而且如果在DataGridView里添加CheckBox、下拉框、等等相关控件时,使用起来十分麻烦,如果阁下觉得使用微软件提供的DataGridView十分麻烦时,这里小弟推荐XPTable给大家使用,XPTable为Codeproject提供开源的第三方控件,其功能十分强大。截图可以看出XPTable里可以添加各式各样的控件。XPTable提供的几个Demo可以点击这里下载:下载Demo.如下是介绍我在项目里使用XPTable的一些分享:1、先下载XPTable编译文件:XPTable.DLL。(点击下载)2、将XPTable,添加到工具箱里,添加完成后将有三个控件:Table、TableModel、ColumnModel(添加到工具箱的方法:A、在工具箱上点右键选择“添加选项卡”(写上自己想写的名字,例如:第三控件),B、再在第三控件这个选项卡上右键点“选择项”在出现的窗体上点浏览,到自己的.dll文件,选择该文件。)如图:3、将相应三个控件添加到Main窗口里如图:4、写代码初始化XPTable如下: string table = this.TableName; if (string.IsNullOrEmpty(table) return; DataTable dt = GetDBInfoBLL.GetTBConfiguration(table); dt.Columns.Remove(表名); dt.Columns.Remove(默认值); dt.Columns.Remove(主键); dt.Columns.Remove(表说明); dt.Columns.Remove(字段序号); dt.Columns.Add(添加说明, Type.GetType(System.String); dt.Columns.Add(表头说明, Type.GetType(System.String); /选择框 添加 CheckBoxColumn checkbox_Add = new CheckBoxColumn(添加, 80); /选择框 修改 CheckBoxColumn checkbox_Update = new CheckBoxColumn(修改, 80); /选择框 列表 CheckBoxColumn checkbox_List = new CheckBoxColumn(列表, 80); /选择框 搜索 CheckBoxColumn checkbox_Search = new CheckBoxColumn(搜索, 80); /下拉框 ComboBoxColumn combobox_search = new ComboBoxColumn(搜索类型, 80); ComboBoxCellEditor searchEditor = new ComboBoxCellEditor(); searchEditor.DropDownStyle = DropDownStyle.DropDownList; searchEditor.Items.AddRange(new string 大于, 小于, 等于, 相同, Other ); combobox_search.Editor = searchEditor; /下拉框 验证 ComboBoxColumn combobox_Verificat = new ComboBoxColumn(验证, 100); ComboBoxCellEditor VerificatEditor = new ComboBoxCellEditor(); VerificatEditor.DropDownStyle = DropDownStyle.DropDownList; VerificatEditor.Items.AddRange(new string 不为空, Classical, Comedy, Rock, Other ); combobox_Verificat.Editor = VerificatEditor; /字段说明 TextColumn text_name = new TextColumn(字段, 100); /字段说明 TextColumn text_desc = new TextColumn(字段说明, 154); /字段 标识 TextColumn text_Ident = new TextColumn(标识, 40); /字段 类型 TextColumn text_type = new TextColumn(类型, 62); /字段 长度 TextColumn text_Length = new TextColumn(长度, 50); /字段 允许为空 TextColumn text_allowEmpty = new TextColumn(为空, 50); /字段 添加说明 TextColumn text_addDesc = new TextColumn(添加说明, 130); /字段,表头 TextColumn text_tableHeader = new TextColumn(表头, 130); this.table.ColumnModel = new ColumnModel(new Column /字段名 text_name, /添加选择框 checkbox_Add, /添加验证下拉框 combobox_Verificat, /修改选择框 checkbox_Update, /列表选择框 checkbox_List, /搜索选择框 checkbox_Search, /搜索类型下拉框 combobox_search, /字段说明 text_desc, /标识 text_Ident, /类型 text_type, /长度 text_Length, /允许为空 text_allowEmpty, /添加说明 text_addDesc, /表头说明 text_tableHeader ); /行数 Row RowList = new Rowdt.Rows.Count; for (int i = 0; i < dt.Rows.Count; i+) /字段名 string name = dt.Rowsi0.ToString(); if (string.IsNullOrEmpty(name) continue; /字段说明 string fieldDesc = dt.Rowsi1.ToString(); /标识 string Ident = dt.Rowsi2.ToString(); /字段类型 string fieldType = dt.Rowsi3.ToString(); /字段长度 string fieldLength = dt.Rowsi4.ToString(); /允许为空 string allowEmpty = dt.Rowsi5.ToString(); /添加说明 string addDesc = dt.Rowsi6.ToString(); /表头说明 string tableHeader = dt.Rowsi7.ToString(); Row r = new Row(new Cell /名称 new Cell(name), /添加选择框 new Cell(name,true), /添加验证下拉框 new Cell(无), /修改选择框 new Cell(name,true), /列表选择框 new Cell(name,true), /搜索选择框 new Cell(name,false), /搜索类型下拉框 new Cell(无), /字段说明 new Cell(fieldDesc), /标识 new Cell(Ident), /类型 new Cell(fieldType), /长度 new Cell(fieldLength), /允许为空 new Cell(allowEmpty), /添加说明 new Cell(addDesc), /表头说明 new Cell(tableHeader) ); RowListi = r; this.table.TableModel = new TableModel(RowList); this.table.BeginEditing += new XPTable.Events.CellEditEventHandler(table_BeginEditing); this.table.TableModel.RowHeight = 21; this.table.EndUpdate(); info.AddDes =this.table.TableModel.Rowsi.Cells12.Text; info.TableHeader =this.table.TableModel.Rowsi.Cells13.Text; InfoList.Add(info); 小弟用XPTable做的Table截图如下:InfoList = new List<CreateInfo>(); for (int i = 0; i < table.RowCount; i+) CreateInfo info = new CreateInfo(); info.Field = this.table.TableModel.Rowsi.Cells0.Text; info.Add =this.table.TableModel.Rowsi.Cells1.Checked; info.Verificat =this.table.TableModel.Rowsi.Cells2.Text; info.Update =this.table.TableModel.Rowsi.Cells3.Checked; info.FieldList =this.table.TableModel.Rowsi.Cells4.Checked; info.SearchField =this.table.TableModel.Rowsi.Cells5.Checked; info.SearchType =this.table.TableModel.Rowsi.Cells6.Text; info.FieldDes =this.table.TableModel.Rowsi.Cells7.Text; info.Ident =this.table.TableModel.Rowsi.Cells8.Text; info.FieldType =this.table.TableModel.Rowsi.Cells9.Text; info.FieldLeng
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 督查督导面试题目及答案
- 新闻稿撰写培训
- 音乐去郊游课件
- 2025年度影视作品编剧辅助与现场管理专业服务合同
- 2025年智能化别墅小区保安公司续签服务协议
- 2025年专业商铺租赁代售及市场推广服务协议
- 2025年高品质住宅小区深度保洁与绿化维护合同
- 2025年重型卡车牌照租赁及专业保险配套服务合同
- 2025年市政桥梁防水改造项目安全应急预案编制与执行合同
- 2025年青少年体育活动场地租赁及赞助商合作协议
- 学校食堂保洁服务方案(技术标)
- 输血反应应急预案完整版课件
- 续贷款申请书范文
- 小孩上户口民族不一致委托书
- 2025年福建中闽能源股份有限公司招聘笔试参考题库含答案解析
- 科研项目管理质量承诺
- 北师大版小学数学教材教法培训
- 物业小区安全生产管理制度
- 医院培训课件:《主动脉夹层的护理》
- 2024版《皮肌炎的临床表现》课件
- 2024年广东湛江廉江市部分机关(镇街道)单位招聘政府雇员11人易考易错模拟试题(共500题)试卷后附参考答案
评论
0/150
提交评论