首页 > 其他 > 详细

Dev属性设置

时间:2017-09-15 19:44:57      阅读:277      评论:0      收藏:0      [点我收藏+]

DisplayFormat 设置显示格式如:{0:P}表示显示为百分号模式。如数据源中为0.5。表示出来为50%

 

2、GridContro总合计及分组合计:

常规总合计直接RunDesigner-Group Summary Items

DisplayFormat 设置显示格式如:{0:P}表示显示为百分号模式。如数据源中为0.5。表示出来为50%

FieldName 设置显示的对应列

ShowInGroupColumnFooter 在那一列下面显示

SummaryType 合计方式。选择Custom表示自定义。CustomSummaryCalculate事件可处理

//Footer行自定义列合计
  GridView view = sender as GridView;
  if (e.Item == view.Columns["RateZk"].SummaryItem)
  {
    decimal x = Convert.ToDecimal(view.Columns["RetailFAmount"].SummaryItem.SummaryValue);
    decimal y = Convert.ToDecimal(view.Columns["RetailAmount"].SummaryItem.SummaryValue);
    view.Columns["RateZk"].SummaryItem.DisplayFormat = "{0:P}";
    )
    e.TotalValue = x / y;
    else
    e.TotalValue = ;
  }

GridContro导出Excel操作:

SaveFileDialog saveFileDialog = new SaveFileDialog();
   saveFileDialog.Title = "导出Excel";
   saveFileDialog.Filter = "Excel文件(*.xls)|*.xls";
   DialogResult dialogResult = saveFileDialog.ShowDialog(this);
   if (dialogResult == DialogResult.OK)
   {
     this.gvbrowse.OptionsPrint.AutoWidth = false; //设置导出的Excel自动调整列宽,列宽和控件的列宽一致
     this.gcbrowse.ExportToXls(saveFileDialog.FileName);
     //this.gcbrowse.ExportToXlsOld(saveFileDialog.FileName);//这个方法默认会自动调整列宽,但是office10以上版本有的会报错
     DevExpress.XtraEditors.XtraMessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
     this.gvbrowse.OptionsPrint.AutoWidth = true;
   }

GridControl列要显示百分号:

Run Designer-Columns列 FormatType="Numeric" FormatString="p"

自动调整所有字段宽度  this.gridView1.BestFitColumns();

显示滚动条:gridView1.OptionsView.ColumnAutoWidth属性是true,即各列的宽度自动调整,你把它设成false,就会出现了。

设置奇、偶行交替颜色

  • OptionsView.EnableAppearanceEvenRow = true;OptionsView.EnableAppearanceOddRow = true;

Dev属性设置

原文:http://www.cnblogs.com/shy1766IT/p/7528084.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!