首先上效果圖
ok灵奖,我來告訴大家
1.首先找到 gridControl 下 GridView的?CustomDrawEmptyForeground?事件,如圖
2.然后就是開始編寫代碼了
????????private void GridView1_CustomDrawEmptyForeground(object sender, DevExpress.XtraGrid.Views.Base.CustomDrawEventArgs e)
? ? ? ? {
? ? ? ? ? ? if (gvSummary.RowCount == 0)
? ? ? ? ? ? {
? ??????????????//文本
? ? ? ? ? ? ? ? string str = "暫未查找到匹配的數(shù)據(jù)!";
? ??????????????//字體
? ? ? ? ? ? ? ? Font f = new Font("微軟雅黑", 16);
????????????????//顯示位置
? ? ? ? ? ? ? ? Rectangle r = new Rectangle(gvSummary.GridControl.Width / 2 - 100, e.Bounds.Top + 45, e.Bounds.Right - 5, e.Bounds.Height - 5);
? ??????????????//顯示顏色
????????????????e.Graphics.DrawString(str, f, Brushes.Gray, r);
? ? ? ? ? ? }
? ? ? ? }
3.這樣基本上就可以實現(xiàn)默認無數(shù)據(jù)顯示了估盘,當然你還可以根據(jù)自己的需要進行改進(每個人查詢的方式不同瓷患,查詢方式寫好,就可以實現(xiàn)效果了)