using DrawGraph; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace AIMS.OperationAanesthesia { public partial class frmPhysiosSetting : Form { public OperationRecord _record; /// /// 修改参数配置委托 /// public delegate void ConfigParamHandler(); /// /// 修改参数配置事件 /// public event ConfigParamHandler ConfigParam; public frmPhysiosSetting() { InitializeComponent(); dgvSetting.AutoGenerateColumns = false; dgvMZTZ.AutoGenerateColumns = false; } private void frmDeletePhysio_Load(object sender, EventArgs e) { FullPanelXS(panelJHYSJXS); dgvSetting.DataSource = _record.PhysioConfigList; dgvMZTZ.DataSource = _record.PhysioAnesConfigList; foreach (DataGridViewRow item in dgvSetting.Rows) { foreach (PhysioDataConfig ade in _record.PhysioConfigList) { if (ade.Id.ToString() == item.Cells[0].Value.ToString()) { item.Cells[3].Value = imageList1.Images[imageList1.Images.IndexOfKey(ade.ImgPath + ".png")]; DataGridViewCellStyle cellStyle = new DataGridViewCellStyle(); string[] str = ade.Color.Split('.'); int A = int.Parse(str[0].ToString()); int R = int.Parse(str[1].ToString()); int G = int.Parse(str[2].ToString()); int B = int.Parse(str[3].ToString()); cellStyle.BackColor = System.Drawing.Color.FromArgb(A, R, G, B); item.Cells[4].Style = cellStyle; break; } } } } private void FullPanelXS(Panel panel) { panel.Controls.Clear(); int rows = 0; int cols = 0; int x = 0; //循环加载CheckBox控件 foreach (PhysioDataConfig ade in _record.PhysioConfigList) { x = cols * 400 + 20; System.Windows.Forms.Label txtName = new System.Windows.Forms.Label(); txtName.Text = ade.Name + " " + ade.Enname; txtName.Font = new System.Drawing.Font("微软雅黑", 10.5f); txtName.Width = 300; txtName.Tag = ade; txtName.Location = new Point(x, rows * (txtName.Height + 3) + 17); panel.Controls.Add(txtName); CheckBox chkYes = new CheckBox(); chkYes.Tag = ade; chkYes.AutoSize = true; chkYes.Location = new Point(x + 300, rows * (txtName.Height + 3) + 20); chkYes.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); chkYes.Size = new System.Drawing.Size(36, 16); chkYes.Text = "显示"; chkYes.UseVisualStyleBackColor = true; chkYes.Tag = ade; if (ade.IsDefalultShow == true) { chkYes.Checked = true; } panel.Controls.Add(chkYes); //如果已加载15行,则另起一列,最多显示3列 rows++; if (rows == 20) { rows = 0; cols++; if (cols == 2) { return; } } } } private void btnDelete_Click(object sender, EventArgs e) { foreach (DataGridViewRow item in dgvSetting.Rows) { foreach (PhysioDataConfig ade in _record.PhysioConfigList) { if (ade.Id.ToString() == item.Cells[0].Value.ToString()) { ade.Color = item.Cells[4].Style.BackColor.A + "." + item.Cells[4].Style.BackColor.R + "." + item.Cells[4].Style.BackColor.G + "." + item.Cells[4].Style.BackColor.B; ade.HighLimit = int.Parse(item.Cells[5].Value.ToString()); ade.LowLimit = int.Parse(item.Cells[6].Value.ToString()); ade.WarningHighLimit = int.Parse(item.Cells[7].Value.ToString()); ade.WarningLowLimit = int.Parse(item.Cells[8].Value.ToString()); ade.ShowImg = bool.Parse(item.Cells[9].Value.ToString()); ade.ShowText = bool.Parse(item.Cells[10].Value.ToString()); ade.IsSplit = bool.Parse(item.Cells[11].Value.ToString()); ade.IsDefalultShow = bool.Parse(item.Cells[12].Value.ToString()); ade.Unit = item.Cells[13].Value.ToString(); ade.YAisx = int.Parse(item.Cells[14].Value.ToString()); ade.PhysioOrder = int.Parse(item.Cells[15].Value.ToString()); ade.SymbolSize = float.Parse(item.Cells[16].Value.ToString()); PhysioDataConfig.UpdatePhysioDataConfig(ade); break; } } } foreach (DataGridViewRow item in dgvMZTZ.Rows) { foreach (PhysioDataConfig ade in _record.PhysioAnesConfigList) { if (ade.Id.ToString() == item.Cells[0].Value.ToString()) { ade.HighLimit = int.Parse(item.Cells[5].Value.ToString()); ade.LowLimit = int.Parse(item.Cells[6].Value.ToString()); ade.WarningHighLimit = int.Parse(item.Cells[7].Value.ToString()); ade.WarningLowLimit = int.Parse(item.Cells[8].Value.ToString()); ade.YAisx = int.Parse(item.Cells[9].Value.ToString()); ade.ShowText = bool.Parse(item.Cells[10].Value.ToString()); ade.IsDefalultShow = bool.Parse(item.Cells[11].Value.ToString()); ade.Unit = item.Cells[12].Value.ToString(); ade.PhysioOrder = int.Parse(item.Cells[13].Value.ToString()); PhysioDataConfig.UpdatePhysioDataConfig(ade); break; } } } foreach (var item in panelJHYSJXS.Controls) { if (item is CheckBox) { PhysioDataConfig ade = (item as CheckBox).Tag as PhysioDataConfig; foreach (var con in _record.PhysioConfigList) { if (ade.Id == con.Id) { con.IsDefalultShow = (item as CheckBox).Checked; break; } } } } ConfigParam(); this.Close(); } private void btnSave_Click(object sender, EventArgs e) { this.Close(); } private void dgvSetting_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 4) { colorDialog1.ShowDialog(); Color color = colorDialog1.Color; DataGridViewCellStyle cellStyle = new DataGridViewCellStyle(); cellStyle.BackColor = color; dgvSetting.Rows[e.RowIndex].Cells[e.ColumnIndex].Style = cellStyle; } } } }