Loading

DEV GridControl表格数据源为空在表格中间显示提醒字符

private static void gv_CustomDrawEmptyForeground(object sender, DevExpress.XtraGrid.Views.Base.CustomDrawEventArgs e)
   {
      DevExpress.XtraGrid.Views.Grid.GridView gv = sender as DevExpress.XtraGrid.Views.Grid.GridView;
      DataView bindingSource = gv.DataSource as DataView;
      
      if (bindingSource != null & bindingSource.Count == 0)
      {
         Font f = new Font("宋体", 16, FontStyle.Bold);
         Rectangle r = new Rectangle(gv.GridControl.Width / 2 - 100, gv.GridControl.Height / 2, e.Bounds.Right - 5, e.Bounds.Height - 5);
         e.Graphics.DrawString("没有查询到数据!", f, Brushes.Red, r);
      }
   }

 

posted @ 2016-03-31 17:33  jevan  阅读(1352)  评论(0编辑  收藏  举报