コード例 #1
0
        private void mniInsertAsCombobox_Click(object sender, EventArgs e)
        {
            if (dgvDE.SelectedRows.Count == 0)
            {
                return;
            }

            frmRecord vFrmRecord = GetActiveRecord();

            if (vFrmRecord != null)
            {
                DeCombobox vDeCombobox = new DeCombobox(vFrmRecord.EmrView.ActiveSectionTopLevelData(),
                                                        dgvDE.SelectedRows[0].Cells[1].Value.ToString());

                vDeCombobox.SaveItem      = false;
                vDeCombobox[DeProp.Index] = dgvDE.SelectedRows[0].Cells[0].Value.ToString();

                if (!vFrmRecord.EmrView.Focused)  // 先给焦点,便于处理光标处域
                {
                    vFrmRecord.EmrView.Focus();
                }

                vFrmRecord.EmrView.InsertItem(vDeCombobox);
            }
            else
            {
                MessageBox.Show("未发现打开的模板!");
            }
        }
コード例 #2
0
        public void PopupDeCombobox(DeCombobox aDeCombobox)
        {
            aDeCombobox.Items.Clear();
            int vCMV = -1;

            DataTable dt = emrMSDB.DB.GetData(string.Format("SELECT DeCode, domainid "
                                                            + "FROM Comm_DataElement WHERE DeID ={0}", aDeCombobox[DeProp.Index]));

            if (dt.Rows.Count > 0)
            {
                vCMV = int.Parse(dt.Rows[0]["domainid"].ToString());
                if (vCMV > 0)  // 有值域
                {
                    DataTable FDBDomain = emrMSDB.DB.GetData(string.Format("SELECT DE.Code, DE.devalue "
                                                                           + "FROM Comm_DataElementDomain DE "
                                                                           + "WHERE DE.domainid = {0}", vCMV));

                    if (FDBDomain.Rows.Count > 0)
                    {
                        for (int i = 0; i < FDBDomain.Rows.Count; i++)
                        {
                            aDeCombobox.Items.Add(new HCCbbItem(FDBDomain.Rows[i]["devalue"].ToString(), FDBDomain.Rows[i]["code"].ToString()));
                        }
                    }
                }
            }
        }
コード例 #3
0
        private void DoDEInsertAsDeCombobox(object sender, EventArgs e)
        {
            DeCombobox vDeCombobox = new DeCombobox(FEmrEdit.TopLevelData(), frmDataElement.GetDeName());

            vDeCombobox.SaveItem      = false;
            vDeCombobox[DeProp.Index] = frmDataElement.GetDeIndex();
            vDeCombobox[DeProp.Name]  = frmDataElement.GetDeName();
            FEmrEdit.InsertItem(vDeCombobox);
        }
コード例 #4
0
        private void mniCombobox_Click(object sender, EventArgs e)
        {
            DeCombobox vDeCombobox = new DeCombobox(FEmrView.ActiveSectionTopLevelData(), "下拉框");

            vDeCombobox.SaveItem      = false;
            vDeCombobox[DeProp.Index] = "1002";  // 控件的数据元属性
            //vDeCombobox.Items.Add("选项1");
            FEmrView.InsertItem(vDeCombobox);
        }
コード例 #5
0
 private void DoRecordDeComboboxGetItem(object sender, EventArgs e)
 {
     if (sender is DeCombobox)
     {
         DeCombobox vCombobox = sender as DeCombobox;
         if (vCombobox[DeProp.Index] == "1002")
         {
             vCombobox.Items.Clear();
             for (int i = 0; i < 20; i++)
             {
                 vCombobox.Items.Add("选项" + i.ToString());
             }
         }
     }
 }
コード例 #6
0
        /// <summary> 插入一个数据元(Combobox形式) </summary>
        public DeCombobox InsertDeCombobox(string aIndex, string aName)
        {
            if ((aIndex == "") || (aName == ""))
            {
                MessageBox.Show("要插入的Combobox索引和名称不能为空!");
                return(null);
            }

            DeCombobox vCombobox = new DeCombobox(FEmrView.ActiveSectionTopLevelData(), aName);

            vCombobox.SaveItem      = false;
            vCombobox[DeProp.Index] = aIndex;
            vCombobox[DeProp.Name]  = aName;
            FEmrView.InsertItem(vCombobox);
            return(vCombobox);
        }
コード例 #7
0
        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();
                }
            }
        }
コード例 #8
0
        public void SetHCView(HCView aHCView, DeCombobox aCombobox)
        {
            if (aCombobox[DeProp.Name] != "")
            {
                this.Text = aCombobox[DeProp.Name];
            }

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

            tbxWidth.Text            = aCombobox.Width.ToString();
            tbxHeight.Text           = aCombobox.Height.ToString();
            tbxText.Text             = aCombobox.Text;
            cbxPrintOnlyText.Checked = aCombobox.PrintOnlyText;
            cbxDeleteAllow.Checked   = aCombobox.DeleteAllow;
            cbxBorderLeft.Checked    = aCombobox.BorderSides.Contains((byte)BorderSide.cbsLeft);
            cbxBorderTop.Checked     = aCombobox.BorderSides.Contains((byte)BorderSide.cbsTop);
            cbxBorderRight.Checked   = aCombobox.BorderSides.Contains((byte)BorderSide.cbsRight);
            cbxBorderBottom.Checked  = aCombobox.BorderSides.Contains((byte)BorderSide.cbsBottom);

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

            cbxSaveItem.Checked = aCombobox.SaveItem;
            dgvItem.Enabled     = cbxSaveItem.Checked;
            dgvItem.RowCount    = aCombobox.Items.Count + 1;
            if (aCombobox.Items.Count > 0)
            {
                for (int i = 0; i < aCombobox.Items.Count; i++)
                {
                    dgvItem.Rows[i].Cells[0].Value = aCombobox.Items[i].Text;
                    if (i < aCombobox.ItemValues.Count)
                    {
                        dgvItem.Rows[i].Cells[1].Value = aCombobox.ItemValues[i].Text;
                    }
                }
            }

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

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

                aCombobox.Text = tbxText.Text;

                if (cbxBorderLeft.Checked)
                {
                    aCombobox.BorderSides.InClude((byte)BorderSide.cbsLeft);
                }
                else
                {
                    aCombobox.BorderSides.ExClude((byte)BorderSide.cbsLeft);
                }

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

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

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

                aCombobox.PrintOnlyText = cbxPrintOnlyText.Checked;
                aCombobox.DeleteAllow   = cbxDeleteAllow.Checked;

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

                aCombobox.SaveItem = cbxSaveItem.Checked;
                aCombobox.Items.Clear();
                aCombobox.ItemValues.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() != "")
                    {
                        aCombobox.Items.Add(new HCCbbItem(dgvItem.Rows[i].Cells[0].Value.ToString()));
                        aCombobox.ItemValues.Add(new HCCbbItem(vsValue));
                    }
                }

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