protected virtual void ShowList() { if (this.popup.Visible == false) { this.list.SelectedIndex = -1; this.UpdateList(); Point p = this.PointToScreen(new Point(0, 0)); p.X += this.PopupOffset.X; p.Y += this.Height + this.PopupOffset.Y; this.popup.Location = p; if (this.list.Items.Count > 0) { this.popup.Show(); if (this.hook == null) { this.hook = new WinHook(this); this.hook.AssignHandle(this.FindForm().Handle); } this.Focus(); } else { SelectedItem = null; } } else { this.UpdateList(); } }
protected virtual void HideList() { this.Mode = EntryMode.Text; if (this.hook != null) { this.hook.ReleaseHandle(); } this.hook = null; // only raise event when the popup is still visible; to avoid duplicate events if (this.popup.Visible) { OnItemSelected(); } this.popup.Hide(); }