using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace Core.LgMes.Client.LgResMgt { public partial class frmO2Times : Core.Mes.Client.Common.frmStyleBase { public frmO2Times() { InitializeComponent(); } public DataTable dtO2Times; //吹氧次数 private void frmOggHistory_Load(object sender, EventArgs e) { DataTable dtO2 = new DataTable(); //临时表 dtO2.Columns.Add("BSTARTTIME"); dtO2.Columns.Add("BENDTIME"); dtO2.Columns.Add("BTIME"); if (dtO2Times.Rows.Count > 0) { DataRow dr = dtO2.NewRow(); dr["BSTARTTIME"] = dtO2Times.Rows[0]["B1STARTTIME"].ToString(); dr["BENDTIME"] = dtO2Times.Rows[0]["B1ENDTIME"].ToString(); dr["BTIME"] = dtO2Times.Rows[0]["B1TIME"].ToString(); dtO2.Rows.Add(dr); if (!string.IsNullOrEmpty(dtO2Times.Rows[0]["B2STARTTIME"].ToString())) { DataRow dr2 = dtO2.NewRow(); dr2["BSTARTTIME"] = dtO2Times.Rows[0]["B2STARTTIME"].ToString(); dr2["BENDTIME"] = dtO2Times.Rows[0]["B2ENDTIME"].ToString(); dr2["BTIME"] = dtO2Times.Rows[0]["B2TIME"].ToString(); dtO2.Rows.Add(dr2); } if (!string.IsNullOrEmpty(dtO2Times.Rows[0]["B3STARTTIME"].ToString())) { DataRow dr3 = dtO2.NewRow(); dr3["BSTARTTIME"] = dtO2Times.Rows[0]["B3STARTTIME"].ToString(); dr3["BENDTIME"] = dtO2Times.Rows[0]["B3ENDTIME"].ToString(); dr3["BTIME"] = dtO2Times.Rows[0]["B3TIME"].ToString(); dtO2.Rows.Add(dr3); } if (!string.IsNullOrEmpty(dtO2Times.Rows[0]["B4STARTTIME"].ToString())) { DataRow dr4 = dtO2.NewRow(); dr4["BSTARTTIME"] = dtO2Times.Rows[0]["B4STARTTIME"].ToString(); dr4["BENDTIME"] = dtO2Times.Rows[0]["B4ENDTIME"].ToString(); dr4["BTIME"] = dtO2Times.Rows[0]["B4TIME"].ToString(); dtO2.Rows.Add(dr4); } if (!string.IsNullOrEmpty(dtO2Times.Rows[0]["B5STARTTIME"].ToString())) { DataRow dr5 = dtO2.NewRow(); dr5["BSTARTTIME"] = dtO2Times.Rows[0]["B5STARTTIME"].ToString(); dr5["BENDTIME"] = dtO2Times.Rows[0]["B5ENDTIME"].ToString(); dr5["BTIME"] = dtO2Times.Rows[0]["B5TIME"].ToString(); dtO2.Rows.Add(dr5); } } this.ultraGrid1.DataSource = dtO2; ultraGrid1.DataBind(); InitializeGrid(); } /// /// 初始化Grid样式 /// private void InitializeGrid() { ultraGrid1.DisplayLayout.Bands[0].Columns["BSTARTTIME"].Header.Caption = "吹氧开始"; ultraGrid1.DisplayLayout.Bands[0].Columns["BSTARTTIME"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit; ultraGrid1.DisplayLayout.Bands[0].Columns["BSTARTTIME"].Width = 140; ultraGrid1.DisplayLayout.Bands[0].Columns["BENDTIME"].Header.Caption = "吹氧结束"; ultraGrid1.DisplayLayout.Bands[0].Columns["BENDTIME"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit; ultraGrid1.DisplayLayout.Bands[0].Columns["BENDTIME"].Width = 140; ultraGrid1.DisplayLayout.Bands[0].Columns["BTIME"].Header.Caption = "吹氧时间"; ultraGrid1.DisplayLayout.Bands[0].Columns["BTIME"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit; ultraGrid1.DisplayLayout.Bands[0].Columns["BTIME"].Width = 75; } } }