void Update() { try { frm_AddNewAnotomy _AddNew = new frm_AddNewAnotomy(_currA); if (_AddNew.ShowDialog() == DialogResult.OK) { foreach (Control ctr in pnlAnatomyList.Controls) { AnatomyControl _Anatomy = ctr as AnatomyControl; if (_Anatomy.isPressed && _Anatomy.Code == _currA.Code) { int idx = pnlAnatomyList.Controls.IndexOf(_Anatomy); pnlAnatomyList.Controls.Remove(_Anatomy); AnatomyControl _NewAnatomy = _AddNew._ACtrl.Copy(); _NewAnatomy._OnClick += new AnatomyControl.OnClick(_Anatomy__OnClick); pnlAnatomyList.Controls.Add(_NewAnatomy); pnlAnatomyList.Controls.SetChildIndex(_NewAnatomy, idx); _NewAnatomy._AnatomyObject.PerformClick(); } } } } catch { } }
void Insert() { try { frm_AddNewAnotomy _AddNew = new frm_AddNewAnotomy(null); if (_AddNew.ShowDialog() == DialogResult.OK) { AnatomyControl _NewAnatomy = _AddNew._ACtrl.Copy(); _NewAnatomy._OnClick += new AnatomyControl.OnClick(_Anatomy__OnClick); pnlAnatomyList.Controls.Add(_NewAnatomy); pnlAnatomyList.ScrollControlIntoView(_NewAnatomy); } } catch { } }