DevExpress gridView查询不到数据时显示 没有查询到数据

来源:互联网 发布:excel表格无法粘贴数据 编辑:程序博客网 时间:2024/06/06 07:24

  查询不到数据时显示 没有查询到数据

gridView1.CustomDrawEmptyForeground += new DevExpress.XtraGrid.Views.Base.CustomDrawEventHandler(gridView1_CustomDrawEmptyForeground);

void gridView1_CustomDrawEmptyForeground(object sender, DevExpress.XtraGrid.Views.Base.CustomDrawEventArgs e)

        {
             if (gridView1.RowCount==0)
            {
                Font f = new Font("宋体", 10, FontStyle.Bold);
                Rectangle re = new Rectangle(e.Bounds.Top + 5,
                    e.Bounds.Left + 5,
                    e.Bounds.Right - 5,
                    e.Bounds.Height - 5);
                e.Graphics.DrawString("没有查询到数据", f, Brushes.Black, re);
            }
        }
0 0
原创粉丝点击