网站大量收购独家精品文档,联系QQ:2885784924

WinForm XtraGrid控件,实现在界面中动态修改列显示,列名列宽.doc

WinForm XtraGrid控件,实现在界面中动态修改列显示,列名列宽.doc

  1. 1、本文档共6页,可阅读全部内容。
  2. 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
WinForm XtraGrid控件,实现在界面中动态修改列显示,列名列宽

WinForm中使用XtraGrid控件,实现在界面中动态修改列显示,列名列宽 发布于 2008-07-11 今天:2 总浏览:2849 次阅读 字体:小 中 大 文章来源: /patrickpan/标签:WinForm XtraGrid控件 动态修改列显示 列名列宽 在使用XtraGrid的gridControl或DataGridView中,里面栏目的设置比较麻烦 。为此我找出了一个比较简便的解决方法。 大致思路如下:定义一个和表结构类似的XML文件,保存表字段的显示标题、是否显示、宽度等信息,在GridControl显示的时候,直接读取这些信息。再在工具条中加上栏目设置的功能。 具体实现步骤: 1. 当然使用传说中的CodeSmith生成XML文件,CodeSmith模板代码如下: %@ CodeTemplate Language C# TargetLanguage text ResponseEncoding UTF-8 Description Generates a update stored procedure. % %@ Property Name SourceDatabase Type SchemaExplorer.DatabaseSchema Category Context Description Database that the documentation should be based on. % %@ Property Name Author Type System.String Default Pantao Optional False Category Description Description About Author % %@ Assembly Name SchemaExplorer % %@ Import Namespace SchemaExplorer % script runat template public string GetSqlParameterStatement ColumnSchema column string param ; switch column.DataType case DbType.Decimal: param + + column.Precision + , + column.Scale + ; break; case DbType.Boolean: case DbType.Int32: case DbType.DateTime: case DbType.Double: case DbType.Single: case DbType.Byte: case DbType.Int64: case DbType.Int16: break; default: if column.Size 0 param + + column.Size + ; break; return param; % TableSchemaCollection tables new TableSchemaCollection SourceDatabase.Tables ; % DataBase Tables: % tables.Count.ToString % Author: % Author % Date: % DateTime.Now.ToShortDateString + + DateTime.Now.ToShortTimeString % % for int i 0; i tables.Count; i++ % % i + 1 + . % TableName:【 % tables[i].Name % 】 % for int k 0; k tables[i].Columns.Count; k++ % % k + 1 % . % tables[i].Columns[k].Name % % if tables[i].Columns[k].IsPrimaryKeyMember % Primary % % % tables[i].Columns[k].NativeType + GetSqlParameterStatement tables[i].Columns[k] % % if tables[i].Columns[k].AllowDBNull % AllowNull % % % [Description:] + tables[i].Columns[k].Description % % % % %

文档评论(0)

80019pp + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档