private void SetOwnerItem(Control control) { if (control == null) { return; } if (control is CToolStripDropDown) { CToolStripDropDown popupControl = control as CToolStripDropDown; _ownerPopup = popupControl; _ownerPopup._childPopup = this; OwnerItem = popupControl.Items[0]; return; } if (control.Parent != null) { SetOwnerItem(control.Parent); } }
public CComboBox() { listbox = new CListBox(this); Click += delegate(object sender, EventArgs e) { _resizeHost.Show(this); }; listbox.Round = new Padding(1); listbox.ItemClick += (a, b) => { _resizeHost.Close(); if (this.Text != listbox.SelectItem.Text) { Text = listbox.SelectItem.Text; if (SelectedIndexChanged != null) { SelectedIndexChanged.Invoke(this, EventArgs.Empty); } } }; _resizeHost = new CToolStripDropDown(listbox); }