internal AutocompleteListView(TextCode tb) { SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint, true); base.Font = new Font(FontFamily.GenericSansSerif, 9); visibleItems = new List <AutocompleteItem>(); VerticalScroll.SmallChange = ItemHeight; MaximumSize = new Size(Size.Width, 180); toolTip.ShowAlways = false; AppearInterval = 500; timer.Tick += new EventHandler(timer_Tick); SelectedColor = Color.Orange; HoveredColor = Color.Red; ToolTipDuration = 3000; toolTip.Popup += ToolTip_Popup; this.tb = tb; tb.KeyDown += new KeyEventHandler(tb_KeyDown); tb.SelectionChanged += new EventHandler(tb_SelectionChanged); tb.KeyPressed += new KeyPressEventHandler(tb_KeyPressed); Form form = tb.FindForm(); if (form != null) { form.LocationChanged += delegate { SafetyClose(); }; form.ResizeBegin += delegate { SafetyClose(); }; form.FormClosing += delegate { SafetyClose(); }; form.LostFocus += delegate { SafetyClose(); }; } tb.LostFocus += (o, e) => { if (Menu != null && !Menu.IsDisposed) { if (!Menu.Focused) { SafetyClose(); } } }; tb.Scroll += delegate { SafetyClose(); }; this.VisibleChanged += (o, e) => { if (this.Visible) { DoSelectedVisible(); } }; }