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); } }