閱讀639 返回首頁    go 阿裏雲 go 技術社區[雲棲]


DEV Gridcontrol 查詢得到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函數後麵的數字來實現。


最後更新:2017-04-03 12:54:34

  上一篇:go ArcSDE10.1使用st_geometry環境配置
  下一篇:go 美圖秀秀 如何修改照片背景顏色