private void txtSearch_TextChanged(object sender, EventArgs e) { if (txtSearch.TextLength == 0) { SetClearImage(null); ResultsPopup.Hide(); return; } if (txtSearch.TextLength > 0 && !ResultsPopup.Visible) { Point pt = new Point(frmSearch.Width, frmSearch.Height); Win32.ClientToScreen(frmSearch.Handle, ref pt); //Win32.ScreenToClient(Win32.GetParent(ResultsPopup.Handle), ref pt); pt.X -= ResultsPopup.Width; //if(pt.X < 0) // pt.X = 0; ResultsPopup.Location = pt; EventHandler activated = null; activated = (object _sender, EventArgs _e) => { Win32.SetFocus(txtSearch.Handle); ResultsPopup.Activated -= activated; }; ResultsPopup.Activated += activated; ResultsPopup.Show(); SetClearImage(Properties.Resources.ClearNormal); } }
private void txtSearch_KeyDown(object sender, KeyEventArgs e) { suppressKeyPress = false; switch (e.KeyCode) { case Keys.Escape: e.Handled = true; suppressKeyPress = true; //txtSearch.Text = ""; ResultsPopup.Hide(); Win32.SetFocus(PluginBase.GetCurrentScintilla()); break; case Keys.Enter: case Keys.Tab: e.Handled = true; suppressKeyPress = true; break; } }