示例#1
0
        private void DoDEInsertAsDeRadioGroup(object sender, EventArgs e)
        {
            DeRadioGroup vDeRadioGropu = new DeRadioGroup(FEmrEdit.TopLevelData());

            vDeRadioGropu[DeProp.Index] = frmDataElement.GetDeIndex();
            vDeRadioGropu[DeProp.Name]  = frmDataElement.GetDeName();
            // 取数据元的选项,选项太多时提示是否都插入
            vDeRadioGropu.AddItem("选项1");
            vDeRadioGropu.AddItem("选项2");
            vDeRadioGropu.AddItem("选项3");

            FEmrEdit.InsertItem(vDeRadioGropu);
        }
示例#2
0
        /// <summary> 插入一个数据元(RadioGroup形式) </summary>
        public DeRadioGroup InsertDeRadioGroup(string aIndex, string aName)
        {
            if ((aIndex == "") || (aName == ""))
            {
                MessageBox.Show("要插入的RadioGroup索引和名称不能为空!");
                return(null);
            }

            DeRadioGroup vRadioGroup = new DeRadioGroup(FEmrView.ActiveSectionTopLevelData());

            vRadioGroup[DeProp.Index] = aIndex;
            vRadioGroup[DeProp.Name]  = aName;
            // 取数据元的选项,选项太多时提示是否都插入
            vRadioGroup.AddItem("选项1");
            vRadioGroup.AddItem("选项2");
            vRadioGroup.AddItem("选项3");
            FEmrView.InsertItem(vRadioGroup);
            return(vRadioGroup);
        }
        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();

            pnlBorder.Visible = false;

            DeCheckBox vDeCheckBox = null;

            if (vControlItem is DeCheckBox)
            {
                vDeCheckBox     = vControlItem as DeCheckBox;
                pnlEdit.Visible = false;
            }

            DeEdit vDeEdit = null;

            if (vControlItem is 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++;
                    }
                }
            }

            DeCombobox vDeCombobox = null;

            if (vControlItem is DeCombobox)
            {
                vDeCombobox = vControlItem as DeCombobox;

                cbxBorderLeft.Checked   = vDeCombobox.BorderSides.Contains((byte)BorderSide.cbsLeft);
                cbxBorderTop.Checked    = vDeCombobox.BorderSides.Contains((byte)BorderSide.cbsTop);
                cbxBorderRight.Checked  = vDeCombobox.BorderSides.Contains((byte)BorderSide.cbsRight);
                cbxBorderBottom.Checked = vDeCombobox.BorderSides.Contains((byte)BorderSide.cbsBottom);
                pnlBorder.Visible       = true;

                foreach (string vItem in vDeCombobox.Items)
                {
                    lstCombobox.Items.Add(vItem);
                }

                dgvCombobox.RowCount = vDeCombobox.Propertys.Count + 1;
                if (vDeCombobox.Propertys.Count > 0)
                {
                    int vRow = 0;
                    foreach (KeyValuePair <string, string> keyValuePair in vDeCombobox.Propertys)
                    {
                        dgvCombobox.Rows[vRow].Cells[0].Value = keyValuePair.Key;
                        dgvCombobox.Rows[vRow].Cells[1].Value = keyValuePair.Value;
                        vRow++;
                    }
                }
            }
            else
            {
                pnlCombobox.Visible = false;
            }

            DeDateTimePicker vDeDateTimePicker = null;

            if (vControlItem is DeDateTimePicker)
            {
                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;
            }

            DeRadioGroup vDeRadioGroup = null;

            if (vControlItem is DeRadioGroup)
            {
                vDeRadioGroup = vControlItem as DeRadioGroup;
                foreach (HCRadioButton vItem in vDeRadioGroup.Items)
                {
                    lstRadioItem.Items.Add(vItem.Text);
                }
            }
            else
            {
                pnlRadioGroup.Visible = false;
            }

            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 (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 (vDeCombobox != null)
                {
                    if (cbxBorderLeft.Checked)
                    {
                        vDeCombobox.BorderSides.InClude((byte)BorderSide.cbsLeft);
                    }
                    else
                    {
                        vDeCombobox.BorderSides.ExClude((byte)BorderSide.cbsLeft);
                    }

                    if (cbxBorderTop.Checked)
                    {
                        vDeCombobox.BorderSides.InClude((byte)BorderSide.cbsTop);
                    }
                    else
                    {
                        vDeCombobox.BorderSides.ExClude((byte)BorderSide.cbsTop);
                    }

                    if (cbxBorderRight.Checked)
                    {
                        vDeCombobox.BorderSides.InClude((byte)BorderSide.cbsRight);
                    }
                    else
                    {
                        vDeCombobox.BorderSides.ExClude((byte)BorderSide.cbsRight);
                    }

                    if (cbxBorderBottom.Checked)
                    {
                        vDeCombobox.BorderSides.InClude((byte)BorderSide.cbsBottom);
                    }
                    else
                    {
                        vDeCombobox.BorderSides.ExClude((byte)BorderSide.cbsBottom);
                    }

                    vDeCombobox.Items.Clear();
                    foreach (string vobj in lstCombobox.Items)
                    {
                        vDeCombobox.Items.Add(vobj.ToString());
                    }

                    string vsValue = "";
                    vDeCombobox.Propertys.Clear();
                    for (int i = 0; i < dgvCombobox.RowCount; i++)
                    {
                        if (dgvCombobox.Rows[i].Cells[0].Value == null)
                        {
                            continue;
                        }

                        if (dgvCombobox.Rows[i].Cells[1].Value == null)
                        {
                            vsValue = "";
                        }
                        else
                        {
                            vsValue = dgvCombobox.Rows[i].Cells[1].Value.ToString();
                        }

                        if (dgvCombobox.Rows[i].Cells[0].Value.ToString().Trim() != "")
                        {
                            vDeCombobox.Propertys.Add(dgvCombobox.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;
                }

                if (vDeRadioGroup != null)
                {
                    vDeRadioGroup.Items.Clear();
                    foreach (object vObj in lstRadioItem.Items)
                    {
                        vDeRadioGroup.AddItem(vObj.ToString());
                    }
                }

                aHCView.BeginUpdate();
                try
                {
                    aHCView.ActiveSection.ReFormatActiveItem();
                }
                finally
                {
                    aHCView.EndUpdate();
                }
            }
        }
示例#4
0
        public void SetHCView(HCView aHCView, DeRadioGroup aRadioGroup)
        {
            if (aRadioGroup[DeProp.Name] != "")
            {
                this.Text = aRadioGroup[DeProp.Name];
            }

            cbxAutoSize.Checked = aRadioGroup.AutoSize;
            tbxWidth.Enabled    = !cbxAutoSize.Checked;
            tbxHeight.Enabled   = !cbxAutoSize.Checked;

            tbxWidth.Text  = aRadioGroup.Width.ToString();
            tbxHeight.Text = aRadioGroup.Height.ToString();

            if (aRadioGroup.RadioStyle == HCRadioStyle.Radio)
            {
                cbbRadioStyle.SelectedIndex = 0;
            }
            else
            {
                cbbRadioStyle.SelectedIndex = 1;
            }

            cbxMulSelect.Checked   = aRadioGroup.MultSelect;
            cbxDeleteAllow.Checked = aRadioGroup.DeleteAllow;

            dgvRadioGroup.RowCount = aRadioGroup.Propertys.Count + 1;
            int vRow = 0;

            if (aRadioGroup.Propertys.Count > 0)
            {
                foreach (KeyValuePair <string, string> keyValuePair in aRadioGroup.Propertys)
                {
                    dgvRadioGroup.Rows[vRow].Cells[0].Value = keyValuePair.Key;
                    dgvRadioGroup.Rows[vRow].Cells[1].Value = keyValuePair.Value;
                    vRow++;
                }
            }

            dgvItem.RowCount = aRadioGroup.Items.Count + 1;
            vRow             = 0;
            foreach (HCRadioButton vItem in aRadioGroup.Items)
            {
                dgvItem.Rows[vRow].Cells[0].Value = vItem.Text;
                dgvItem.Rows[vRow].Cells[1].Value = vItem.TextValue;
                vRow++;
            }

            this.ShowDialog();
            if (this.DialogResult == DialogResult.OK)
            {
                aRadioGroup.AutoSize = cbxAutoSize.Checked;
                if (!cbxAutoSize.Checked)  // 自定义大小
                {
                    int vi = aRadioGroup.Width;
                    if (int.TryParse(tbxWidth.Text, out vi))
                    {
                        aRadioGroup.Width = vi;
                    }

                    vi = aRadioGroup.Height;
                    if (int.TryParse(tbxHeight.Text, out vi))
                    {
                        aRadioGroup.Height = vi;
                    }
                }

                if (cbbRadioStyle.SelectedIndex == 0)
                {
                    aRadioGroup.RadioStyle = HCRadioStyle.Radio;
                }
                else
                {
                    aRadioGroup.RadioStyle = HCRadioStyle.CheckBox;
                }

                aRadioGroup.MultSelect  = cbxMulSelect.Checked;
                aRadioGroup.DeleteAllow = cbxDeleteAllow.Checked;

                string vsValue = "";
                aRadioGroup.Propertys.Clear();
                for (int i = 0; i < dgvRadioGroup.RowCount; i++)
                {
                    if (dgvRadioGroup.Rows[i].Cells[0].Value == null)
                    {
                        continue;
                    }

                    if (dgvRadioGroup.Rows[i].Cells[1].Value == null)
                    {
                        vsValue = "";
                    }
                    else
                    {
                        vsValue = dgvRadioGroup.Rows[i].Cells[1].Value.ToString();
                    }

                    if (dgvRadioGroup.Rows[i].Cells[0].Value.ToString().Trim() != "")
                    {
                        aRadioGroup.Propertys.Add(dgvRadioGroup.Rows[i].Cells[0].Value.ToString(), vsValue);
                    }
                }

                aRadioGroup.Items.Clear();
                for (int i = 0; i < dgvItem.RowCount; i++)
                {
                    if (dgvItem.Rows[i].Cells[0].Value == null)
                    {
                        continue;
                    }

                    if (dgvItem.Rows[i].Cells[1].Value == null)
                    {
                        vsValue = "";
                    }
                    else
                    {
                        vsValue = dgvItem.Rows[i].Cells[1].Value.ToString();
                    }

                    if (dgvItem.Rows[i].Cells[0].Value.ToString().Trim() != "")
                    {
                        aRadioGroup.AddItem(dgvItem.Rows[i].Cells[0].Value.ToString(), vsValue);
                    }
                }

                aHCView.BeginUpdate();
                try
                {
                    aHCView.ActiveSection.ReFormatActiveItem();
                }
                finally
                {
                    aHCView.EndUpdate();
                }
            }
        }