private void DoDEInsertAsDeCheckBox(object sender, EventArgs e) { DeCheckBox vDeCheckBox = new DeCheckBox(FEmrEdit.TopLevelData(), frmDataElement.GetDeName(), false); vDeCheckBox[DeProp.Index] = frmDataElement.GetDeIndex(); vDeCheckBox[DeProp.Name] = frmDataElement.GetDeName(); FEmrEdit.InsertItem(vDeCheckBox); }
/// <summary> 插入一个数据元(CheckBox形式) </summary> public DeCheckBox InsertDeCheckBox(string aIndex, string aName) { if ((aIndex == "") || (aName == "")) { MessageBox.Show("要插入的CheckBox索引和名称不能为空!"); return(null); } DeCheckBox vCheckBox = new DeCheckBox(FEmrView.ActiveSectionTopLevelData(), aName, false); vCheckBox[DeProp.Index] = aIndex; vCheckBox[DeProp.Name] = aName; FEmrView.InsertItem(vCheckBox); return(vCheckBox); }
public void SetHCView(HC.View.HCView aHCView) { HCControlItem vControlItem = aHCView.ActiveSectionTopLevelData().GetActiveItem() as HCControlItem; cbxAutoSize.Checked = vControlItem.AutoSize; tbxWidth.Text = vControlItem.Width.ToString(); tbxHeight.Text = vControlItem.Height.ToString(); tbxText.Text = vControlItem.Text; pnlBorder.Visible = false; DeCheckBox vDeCheckBox = null; if (vControlItem is DeCheckBox) { this.Text = "DeCheckBox属性"; vDeCheckBox = vControlItem as DeCheckBox; } DeEdit vDeEdit = null; if (vControlItem is DeEdit) { this.Text = "DeEdit属性"; vDeEdit = vControlItem as DeEdit; cbxBorderLeft.Checked = vDeEdit.BorderSides.Contains((byte)BorderSide.cbsLeft); cbxBorderTop.Checked = vDeEdit.BorderSides.Contains((byte)BorderSide.cbsTop); cbxBorderRight.Checked = vDeEdit.BorderSides.Contains((byte)BorderSide.cbsRight); cbxBorderBottom.Checked = vDeEdit.BorderSides.Contains((byte)BorderSide.cbsBottom); pnlBorder.Visible = true; dgvEdit.RowCount = vDeEdit.Propertys.Count + 1; if (vDeEdit.Propertys.Count > 0) { int vRow = 0; foreach (KeyValuePair <string, string> keyValuePair in vDeEdit.Propertys) { dgvEdit.Rows[vRow].Cells[0].Value = keyValuePair.Key; dgvEdit.Rows[vRow].Cells[1].Value = keyValuePair.Value; vRow++; } } } else { pnlEdit.Visible = false; } DeDateTimePicker vDeDateTimePicker = null; if (vControlItem is DeDateTimePicker) { this.Text = "DeDateTime属性"; vDeDateTimePicker = vControlItem as DeDateTimePicker; cbxBorderLeft.Checked = vDeDateTimePicker.BorderSides.Contains((byte)BorderSide.cbsLeft); cbxBorderTop.Checked = vDeDateTimePicker.BorderSides.Contains((byte)BorderSide.cbsTop); cbxBorderRight.Checked = vDeDateTimePicker.BorderSides.Contains((byte)BorderSide.cbsRight); cbxBorderBottom.Checked = vDeDateTimePicker.BorderSides.Contains((byte)BorderSide.cbsBottom); pnlBorder.Visible = true; cbbDTFormat.Text = vDeDateTimePicker.Format; } else { pnlDateTime.Visible = false; } int vHeight = 0; if (pnlSize.Visible) { vHeight += pnlSize.Height; } else if (pnlEdit.Visible) { vHeight += pnlEdit.Height; } else if (pnlDateTime.Visible) { vHeight += pnlDateTime.Height; } this.Height = vHeight; this.ShowDialog(); if (this.DialogResult == System.Windows.Forms.DialogResult.OK) { vControlItem.AutoSize = cbxAutoSize.Checked; if (!cbxAutoSize.Checked) // 自定义大小 { int vValue = 0; if (int.TryParse(tbxWidth.Text, out vValue)) { vControlItem.Width = vValue; } if (int.TryParse(tbxHeight.Text, out vValue)) { vControlItem.Height = vValue; } } if (tbxText.Text != "") { vControlItem.Text = tbxText.Text; } if (vDeEdit != null) { if (cbxBorderLeft.Checked) { vDeEdit.BorderSides.InClude((byte)BorderSide.cbsLeft); } else { vDeEdit.BorderSides.ExClude((byte)BorderSide.cbsLeft); } if (cbxBorderTop.Checked) { vDeEdit.BorderSides.InClude((byte)BorderSide.cbsTop); } else { vDeEdit.BorderSides.ExClude((byte)BorderSide.cbsTop); } if (cbxBorderRight.Checked) { vDeEdit.BorderSides.InClude((byte)BorderSide.cbsRight); } else { vDeEdit.BorderSides.ExClude((byte)BorderSide.cbsRight); } if (cbxBorderBottom.Checked) { vDeEdit.BorderSides.InClude((byte)BorderSide.cbsBottom); } else { vDeEdit.BorderSides.ExClude((byte)BorderSide.cbsBottom); } string vsValue = ""; vDeEdit.Propertys.Clear(); for (int i = 0; i < dgvEdit.RowCount; i++) { if (dgvEdit.Rows[i].Cells[0].Value == null) { continue; } if (dgvEdit.Rows[i].Cells[1].Value == null) { vsValue = ""; } else { vsValue = dgvEdit.Rows[i].Cells[1].Value.ToString(); } if (dgvEdit.Rows[i].Cells[0].Value.ToString().Trim() != "") { vDeEdit.Propertys.Add(dgvEdit.Rows[i].Cells[0].Value.ToString(), vsValue); } } } if (vDeDateTimePicker != null) { if (cbxBorderLeft.Checked) { vDeDateTimePicker.BorderSides.InClude((byte)BorderSide.cbsLeft); } else { vDeDateTimePicker.BorderSides.ExClude((byte)BorderSide.cbsLeft); } if (cbxBorderTop.Checked) { vDeDateTimePicker.BorderSides.InClude((byte)BorderSide.cbsTop); } else { vDeDateTimePicker.BorderSides.ExClude((byte)BorderSide.cbsTop); } if (cbxBorderRight.Checked) { vDeDateTimePicker.BorderSides.InClude((byte)BorderSide.cbsRight); } else { vDeDateTimePicker.BorderSides.ExClude((byte)BorderSide.cbsRight); } if (cbxBorderBottom.Checked) { vDeDateTimePicker.BorderSides.InClude((byte)BorderSide.cbsBottom); } else { vDeDateTimePicker.BorderSides.ExClude((byte)BorderSide.cbsBottom); } vDeDateTimePicker.Format = cbbDTFormat.Text; } aHCView.BeginUpdate(); try { aHCView.ActiveSection.ReFormatActiveItem(); } finally { aHCView.EndUpdate(); } } }
private void mniCheckbox_Click(object sender, EventArgs e) { DeCheckBox vCheckBox = new DeCheckBox(FEmrView.ActiveSectionTopLevelData(), "勾选框", false); FEmrView.InsertItem(vCheckBox); }