请参照前文DevExpress GridView常用功能总结(三)
1) GridView内容打印
1. private void btnPrint_Click(object sender, EventArgs e) 2. { 3. 4. PrintableComponentLink link = new PrintableComponentLink(new PrintingSystem()); 5. link.Component = this.gridUser; 6. link.Landscape = true; 7. link.PaperKind = System.Drawing.Printing.PaperKind.A3; 8. link.CreateMarginalHeaderArea += new CreateAreaEventHandler(Link_CreateMarginalHeaderArea); 9. link.CreateDocument(); 10. link.ShowPreview(); 11. }
2) 获取某行某列值
this.gridView1.GetRowCellValue(行号, 列名).ToString().Trim()
3) 自定义文本
1. #region 事件自定义列显示 2. /// <summary> 3. /// 自定义列显示 4. /// </summary> 5. private void gridView1_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e) 6. { 7. 8. if (e.Column.FieldName == "列名") 9. {
4) 自定行序号
1. #region 事件_gridView2序号设置 2. /// <summary> 3. /// 序号设置 4. /// </summary> 5. private void gridView1_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e) 6. { 7. 8. e.Info.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; 9. if (e.RowHandle >= 0) 10. {
本站文章除注明转载外,均为本站原创或翻译
欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明:文章转载自:DevExpress控件中文网 [https://www.devexpresscn.com/]
本文地址:https://www.devexpresscn.com/post/923.html
欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明:文章转载自:DevExpress控件中文网 [https://www.devexpresscn.com/]
本文地址:https://www.devexpresscn.com/post/923.html