本文实例展示了devexpress实现gridview当无数据行时提示消息的方法,具体步骤如下:
主要功能代码部分如下:
/// <summary> /// 设置当没有数据行的提示信息『customdrawemptyforeground』 /// </summary> /// <param name="gridview">gridview</param> /// <param name="e">customdraweventargs</param> /// <param name="norecordmsg">提示信息</param> public static void drawnorowcountmessage(this gridview gridview, customdraweventargs e, string norecordmsg) { if (gridview == null) throw new argumentnullexception("gridview"); if (gridview.rowcount == 0) { if (!string.isnullorempty(norecordmsg)) { font _font = new font("宋体", 10, fontstyle.bold); rectangle _r = new rectangle(e.bounds.left + 5, e.bounds.top + 5, e.bounds.width - 5, e.bounds.height - 5); e.graphics.drawstring(norecordmsg, _font, brushes.black, _r); } } }
代码使用方法如下:
private void gvlamptotal_customdrawemptyforeground(object sender, devexpress.xtragrid.views.base.customdraweventargs e) { gvlamptotal.drawnorowcountmessage(e, "暂无符合的数据!"); }
代码运行效果如下:
如对本文有疑问, 点击进行留言回复!!
使用Visual Studio2019创建C#项目(窗体应用程序、控制台应用程序、Web应用程序)
C#实现获取本地内网(局域网)和外网(公网)IP地址的方法分析
网友评论