首页 > 其他 > 详细

DEV Gridcontrol 查询得到0条记录时显示自定义的字符提示/显示

时间:2014-01-21 00:51:35      阅读:331      评论:0      收藏:0      [点我收藏+]
private void gridView_CustomDrawEmptyForeground(object sender, DevExpress.XtraGrid.Views.Base.CustomDrawEventArgs e)
        {
            if (this.judge_ds(dsDt))
            {
                string str = "没有查询到你所想要的数据!";
                Font f = new Font("宋体", 10, FontStyle.Bold);
                Rectangle r = new Rectangle(e.Bounds.Top + 25, e.Bounds.Left + 25, e.Bounds.Right - 25, e.Bounds.Height - 25);
                e.Graphics.DrawString(str, f, Brushes.Black, r);
            }
        }
#region 判断ds是否为空
        private bool judge_ds(DataSet ds)
        {
            bool flag = false;
            if (ds == null||ds.Tables.Count == 0||(ds.Tables.Count == 1 && ds.Tables[0].Rows.Count == 0))
            {
                flag = true;
            }
            return flag;
        }  
        #endregion

小注:

如果显示提示信息的位置不对可以通过调整,Rectangle函数后面的数字来实现。


DEV Gridcontrol 查询得到0条记录时显示自定义的字符提示/显示

原文:http://blog.csdn.net/jiankunking/article/details/18360299

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!