private void hideSelectorList() { List <SelectorListBox> list = new List <SelectorListBox>(); for (int i = 0; i < Controls.Count; i++) { SelectorListBox s = Controls[i] as SelectorListBox; if (s != null) { list.Add(s); } } if (list.Count > 0) { foreach (SelectorListBox s in list) { Control p = s.Parent; if (p != null) { p.Controls.Remove(s); } } } }
private void initEnumList() { Type t = DataType.LibType; if (t.IsEnum) { if (_enumList != null) { Control p = _enumList.Parent; if (p == null) { _enumList = null; } else { Type t0 = _enumList.Tag as Type; if (t0 == null || !t.Equals(t0)) { p.Controls.Remove(_enumList); _enumList = null; } } } if (_enumList == null) { MathNodeRoot mr = this.root; if (mr != null) { MathExpCtrl p = mr.Viewer; if (p != null) { Array a = Enum.GetValues(t); if (a.Length > 0) { _enumList = new SelectorListBox(); _enumList.LostFocus += new EventHandler(_enumList_LostFocus); _enumList.Click += new EventHandler(_enumList_Click); _enumList.KeyPress += new KeyPressEventHandler(_enumList_KeyPress); _enumList.SelectedIndexChanged += new EventHandler(_enumList_SelectedIndexChanged); _enumList.Tag = t; for (int i = 0; i < a.Length; i++) { object v = a.GetValue(i); int n = _enumList.Items.Add(v); if (v.Equals(_value)) { _enumList.SelectedIndex = n; } } _enumList.Location = Position; p.Controls.Add(_enumList); _enumList.Focus(); } } } } if (_enumList != null) { _enumList.Show(); _enumList.Focus(); } } else { if (_enumList != null) { Control p = _enumList.Parent; if (p != null) { p.Controls.Remove(_enumList); } } _enumList = null; } }