GridControl 无数据时显示信息

图例:

主要代码如下:

说明:给GridView添加事件gv_CustomDrawEmptyForeground

  private void gv_CustomDrawEmptyForeground(object sender, DevExpress.XtraGrid.Views.Base.CustomDrawEventArgs e)
        {
            int num = 100;
            if (DSMain.Tables[0].Rows.Count < 1) {
                string str = "没有找到你要查询的数据!";
                Font f = new Font("华文中宋", 10, FontStyle.Regular);
                Rectangle rec = new Rectangle(e.Bounds.Top + num, e.Bounds.Left + num, e.Bounds.Right - num, e.Bounds.Bottom - num);
                e.Graphics.DrawString(str, f, Brushes.Black, rec);            
            }
        }



版权声明:本文为博主原创文章,未经博主允许不得转载。

 

posted @ 2015-04-28 15:07  Jackerson  阅读(401)  评论(0)    收藏  举报