/// <summary> /// 排队列表和等待列表为空处理 /// </summary> /// <param name="sender">触发控件</param> /// <param name="e">控件属性</param> private void GridView_CustomDrawEmptyForeground(object sender, DevExpress.XtraGrid.Views.Base.CustomDrawEventArgs e) { ColumnView columnView = sender as ColumnView; if (columnView.GridControl.DataSource == null) { string str = "当前没有数据!"; Font f = new Font("宋体", 10, FontStyle.Bold); Rectangle r = new Rectangle(e.Bounds.Top + 30, e.Bounds.Left + 30, e.Bounds.Right - 5, e.Bounds.Height - 5); e.Graphics.DrawString(str, f, Brushes.Black, r); } }
private void gridView1_CustomDrawEmptyForeground(object sender, DevExpress.XtraGrid.Views.Base.CustomDrawEventArgs e) { BindingSource bindingSource = bsData.DataSource as BindingSource; if (bindingSource == null || bindingSource.Count == 0) { string str = "没有查询到你所想要的数据!"; Font f = 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(str, f, Brushes.Black, r); } }
private void gridView1_CustomDrawEmptyForeground(object sender, DevExpress.XtraGrid.Views.Base.CustomDrawEventArgs e) { string s = string.Empty; ColumnView view = sender as ColumnView; BindingSource dataSource = view.DataSource as BindingSource; if (dataSource.Count == 0) { s = "没有数据"; } else { s = "没有符合条件的数据"; } Font font = new Font("Tahoma", 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(s, font, Brushes.Black, r); }
private void gvwArea_CustomDrawEmptyForeground(object sender, DevExpress.XtraGrid.Views.Base.CustomDrawEventArgs e) { Tools.Help.GridViewDrawEmptyForeground(gvwArea, sender, e); }
/// <summary> /// 当Grid为空时提示文字 /// </summary> /// <param name="gridView"></param> /// <param name="sender"></param> /// <param name="e"></param> public static void GridViewDrawEmptyForeground(DevExpress.XtraGrid.Views.Grid.GridView gridView, object sender, DevExpress.XtraGrid.Views.Base.CustomDrawEventArgs e) { ColumnView columnView = sender as ColumnView; BindingSource bindingSource = gridView.DataSource as BindingSource; if (bindingSource == null || bindingSource.Count == 0) { string str = "没有查询到你所想要的数据!"; Font f = new Font("宋体", 10, FontStyle.Bold); Rectangle r = new Rectangle(e.Bounds.Top + 55, e.Bounds.Left + 35, e.Bounds.Right - 35, e.Bounds.Height - 35); e.Graphics.DrawString(str, f, Brushes.Black, r); } }