using DevExpress.XtraEditors; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Data.Entity; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Documents; using System.Windows.Forms; using XdCxRhDW.App.Model; using XdCxRhDW.Entity; using XdCxRhDW.Repostory; namespace XdCxRhDW.App.PopupControl { public partial class ShowCheckCtrl : DevExpress.XtraEditors.XtraUserControl { PosRes posItem; List list = new List(); public ShowCheckCtrl() { InitializeComponent(); gridShowCheck.UseDefault(list); } public ShowCheckCtrl(PosRes posItem) :this() { this.posItem = posItem; } private async void ShowCxCtrl_Load(object sender, EventArgs e) { if (posItem.CheckResID == null)//没有检测结果 return; using (RHDWPartContext db = RHDWPartContext.GetContext(posItem.SigTime)) { if (db.DatabaseExist) { var items = await db.CheckRes.Where(p => p.ID == posItem.CheckResID).ToListAsync(); this.list.AddRange(items); } } gridView1.RefreshData(); } private void gridView1_CustomDrawEmptyForeground(object sender, DevExpress.XtraGrid.Views.Base.CustomDrawEventArgs e) { if (gridView1.RowCount == 0) { string txt = "没有检测结果信息"; var s = e.Appearance.CalcTextSize(e.Cache, txt, e.Bounds.Width).ToSize(); var x = (e.Bounds.Width - s.Width) / 2; var y = (e.Bounds.Height - s.Height) / 2; e.Appearance.ForeColor = Color.Gray; e.Appearance.DrawString(e.Cache, txt, new Rectangle(x, y, s.Width, s.Height)); } } private void gridView1_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e) { if (e.Value == null) e.DisplayText = "--"; } } }