表格GridView.CustomDrawEmptyForeground事件显示没有查询到数据
表格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;
}
}