XtraGrid gridview基本用法

XtraGrid gridview基本用法

ID:37905670

大小:47.00 KB

页数:10页

时间:2019-06-02

XtraGrid gridview基本用法_第1页
XtraGrid gridview基本用法_第2页
XtraGrid gridview基本用法_第3页
XtraGrid gridview基本用法_第4页
XtraGrid gridview基本用法_第5页
资源描述:

《XtraGrid gridview基本用法》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、XtraGridgridview基本用法DevExpressXtraGrid的功能实在强大,刚使用的时候看到一大片属性设置,分不清东南西北,参照demo和使用中的一些经验,记录一下使用方法。现在数据库访问都使用ORM技术了,对于DataSouce绑定以下是以IList为说明对象。控件基本定义DevExpress.XtraGrid.GridControlgridControl1;1、数据绑定(IList)DevExpress.XtraGrid.Views.Grid.GridViewgridView1;IListlist=newBindingList

2、yClass>();//初始listlist.Add(A);list.Add(B);………..gridControl1.DataSource=list;2、在Grid上编辑数据修改属性gridView1.OptionsView.NewItemRowPosition,设为Top或Bottom可以在Grid上添加数据。(在demo中原文:arecordobjectmustbeinheritedfromtheIEditableObjectclassifyouneedtheabilitytocancelnewlyaddedrecordsviathegrid)译:如果你需要通过

3、gird取消新建的记录,你的记录对象必须实现IEditableObject(注:在测试中,感觉不需要继承IEditableObject,在grid编辑后也能实现取消。demo通过实现IEditableObject的BeginEdit、CancelEdit方法,数据编辑后恢复特定数据。不使用grid直接修改数据,可以考虑这种恢复原数据的方法。)3、修改列(Column)格式DevExpress.XtraGrid.Columns.GridColumncol=gridView1.Columns[0];数据对齐方式col.AppearanceCell.TextOptions.

4、HAlignment,默认值Default,可选值Default/Near/Center/Far。说明:以下情况是基于从左到右的文字排列;若是从右到左,用法相反。Default:数据默认的对齐方式Near:左对齐Center:居中对齐Far:右对齐列标题col.Caption对应绑定数据的属性col.FieldName排列顺序col.VisibleIndex格式化显示数据Col.DisplayFormat.FormatTypeCol.DisplayFormat.FormatCol.DisplayFormat.FormatString区别:FormatType/Form

5、atString使用当前系统的语言区域设置,Format使用特定的System.IFormatProvider设置。(原文注释:UsetheFormatTypeandFormatStringpropertiestoformatvaluesbasedonthecurrentlanguageandregionalsettings(culture).FormatTypespecifiesthetypeofvaluestobeformatted.FormatStringspecifiesaformatpatternappropriateforthecurrentFormatT

6、ypevalue.YoucanrefertotheStandardNumericFormatStringsandDateandTimeFormatStringstopicsinMSDNforinformationonformatspecifiers.SettingtheFormatTypepropertychangestheformatproviderusedwhenformattingvaluesbytheGetDisplayTextfunction.Formatproviderssupplyinforwww.baiyuewang.netmationsuchasth

7、echaractertouseasthedecimalpointwhenformattingnumericstringsandtheseparationcharactertousewhenformattingaSystem.DateTimeobject.TheFormatpropertyspecifiestheformatprovidertouse.YoucanchangetheFormatpropertyexplicitlybyassigningaSystem.IFormatProviderobject.Thiscanbeusefulifyouwi

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。