表格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
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

版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
NewDoc C/S框架网