/// <summary> /// Shows the completion list popup at a given point on screen /// </summary> /// <param name="NearRectangle">Normally, the popup list will be shown /// right under this block (under NearRectangle)</param> /// <param name="parentControl">DrawWindow that causes this popup to show</param> public void Show(Rectangle nearRectangle, Control parent) { if (this.Visible) { return; } ParentControl = parent; FillItems(); if (lstItems.Items.Count == 0) { return; } this.Parent = parent.Parent; this.BringToFront(); CalcSize(); CalcStartPosition(nearRectangle, parent); this.Show(); this.lstItems.Focus(); if (CurrentList != null) { CurrentList.RaiseVisibleChanged(true); } }
private bool hidingList = false; // guard public void HideList() { if (hidingList || CurrentList == null) { return; } hidingList = true; using (Redrawer r = new Redrawer(CurrentList.HostBlock.Root)) { ViewWindow v = ParentControl as ViewWindow; if (v != null) { v.ShouldRedrawOnWindowPaint = false; } ParentControl.Focus(); Hide(); Application.DoEvents(); if (v != null) { v.ShouldRedrawOnWindowPaint = true; } if (CurrentList != null) { CurrentList.RaiseVisibleChanged(false); } } // lstItems.BeginUpdate(); // lstItems.Items.Clear(); // lstItems.EndUpdate(); hidingList = false; }