欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

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)行效果如下:

相關(guān)文章

最新評(píng)論