DevExpress實(shí)現(xiàn)GridView當(dāng)無(wú)數(shù)據(jù)行時(shí)提示消息
更新時(shí)間:2014年08月07日 09:33:46 投稿:shichen2014
這篇文章主要介紹了DevExpress實(shí)現(xiàn)GridView當(dāng)無(wú)數(shù)據(jù)行時(shí)提示消息,需要的朋友可以參考下
本文實(shí)例展示了DevExpress實(shí)現(xiàn)GridView當(dāng)無(wú)數(shù)據(jù)行時(shí)提示消息的方法,具體步驟如下:
主要功能代碼部分如下:
/// <summary> /// 設(shè)置當(dāng)沒(méi)有數(shù)據(jù)行的提示信息『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, "暫無(wú)符合的數(shù)據(jù)!"); }
代碼運(yùn)行效果如下:
您可能感興趣的文章:
- ASP.NET GridView控件在列上格式化時(shí)間及DataFormatString使用
- asp.net DataFormatString格式化GridView
- ASP.NET數(shù)據(jù)綁定GridView控件使用技巧
- ASP.NET數(shù)據(jù)綁定之GridView控件
- 利用jQuery及AJAX技術(shù)定時(shí)更新GridView的某一列數(shù)據(jù)
- asp.net中GridView數(shù)據(jù)鼠標(biāo)移入顯示提示信息
- asp.net讀取excel中的數(shù)據(jù)并綁定在gridview
- 使用ajax局部刷新gridview進(jìn)行數(shù)據(jù)綁定示例
- c#利用Excel直接讀取數(shù)據(jù)到DataGridView
- js獲取GridView中行數(shù)據(jù)的兩種方法 分享
- C#與SQL連接:GridView控件對(duì)數(shù)據(jù)庫(kù)的操作
- asp.net Gridview數(shù)據(jù)列中實(shí)現(xiàn)鼠標(biāo)懸浮變色
- Gridview利用DataFormatString屬性設(shè)置數(shù)據(jù)格式的方法
相關(guān)文章
C#的WebBrowser的操作與注意事項(xiàng)介紹
C#的WebBrowser的操作與注意事項(xiàng)介紹,需要的朋友可以參考一下2013-03-03- 本文章來(lái)給各位同學(xué)介紹關(guān)于C#單擊菜單欄或工具欄時(shí)通過(guò)反射打開窗體的方法,有需要了解的朋友可進(jìn)入?yún)⒖紖⒖肌?/div> 2015-05-05
C# 未將對(duì)象引用設(shè)置到對(duì)象的實(shí)例
c#開發(fā)過(guò)程中出現(xiàn)未將對(duì)象引用設(shè)置到對(duì)象的實(shí)例,錯(cuò)誤一般是下面的原因,軟件中也是因?yàn)闆](méi)有獲取到數(shù)據(jù)導(dǎo)致,需要的朋友可以參考下2022-09-09WinForm中BackgroundWorker控件用法簡(jiǎn)單實(shí)例
這篇文章主要介紹了WinForm中BackgroundWorker控件用法,以一個(gè)簡(jiǎn)單實(shí)例形式分析了BackgroundWorker控件的定義、設(shè)置及使用技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-08-08C# web應(yīng)用程序不能訪問(wèn)app_code下類的原因以及解決方法
本文主要介紹了C#web應(yīng)用程序不能訪問(wèn)app_code下類的原因以及解決方法。具有很好的參考價(jià)值,下面跟著小編一起來(lái)看下吧2017-02-02最新評(píng)論