Example #1
0
 public AnatomyControl(frm_ChooseAnatomy Parent, string Code, string Vn_Name, string En_Name, int STT)
 {
     InitializeComponent();
     this.STT = STT;
     this.Parent = Parent;
     this.Code = Code;
     this.Vn_Name = Vn_Name;
     this.En_Name = En_Name;
     AnatomyObject.Text = Vn_Name;
     AnatomyObject.Click += new EventHandler(AnatomyObject_Click);
 }
        private void cmdChooseAnatomy_Click(object sender, EventArgs e)
        {
            frm_ChooseAnatomy _ChooseAnatomy = new frm_ChooseAnatomy();
            if (_ChooseAnatomy.ShowDialog() == DialogResult.OK)
            {
                foreach (Control ctr in _ChooseAnatomy._pnlAnatomy.Controls)
                {
                    AnatomyControl _Anatomy = ctr as AnatomyControl;
                    if (_Anatomy.isPressed)
                    {

                        if (!isExistAnatomy(_Anatomy.Code))
                        {
                            AnatomyControl _NewAnatomy = _Anatomy.Copy();
                            AddRow(_NewAnatomy.Code, "", _NewAnatomy.Vn_Name, _NewAnatomy.En_Name, "", "", CurrDevice_ID, 0);
                            _NewAnatomy._OnClick += new AnatomyControl.OnClick(_NewAnatomy__OnClick);
                            _NewAnatomy.Width = pnlAnatomyList.Width - 10;
                            pnlAnatomyList.Controls.Add(_NewAnatomy);
                            _NewAnatomy.Size = new Size(191, 64);
                            _NewAnatomy._AnatomyObject.PerformClick();

                        }
                    }
                }
            }
        }