表格GridView.CustomDrawEmptyForeground事件显示没有查询到数据
作者:C/S框架网  发布日期:2018-12-07 19:19:43
  表格GridView.CustomDrawEmptyForeground事件显示没有查询到数据


C# Code:

private static void GridView_CustomDrawEmptyForeground(object sender, DevExpress.XtraGrid.Views.Base.CustomDrawEventArgs e)
{
   if ((sender as GridView).RowCount == 0)
   {
      int width = 300;
      int height = 60;
      int font_size = 18;
      string str = "* 没有查询到数据!\r\n* no data found!";
      Font f = new Font("微软雅黑", font_size, FontStyle.Bold);
      Rectangle r = new Rectangle((e.Bounds.Width - width) / 2, (e.Bounds.Height - height) / 2, width, height);
      e.Graphics.DrawString(str, f, Brushes.LightBlue, r);
      e.Handled = true;
   }
}

//来源:C/S框架网(www.csframework.com) QQ:23404761



贴图图片
上一篇 下一篇