简体   繁体   中英

ContextMenuStrip without stealing focus

Do you have any idea how to show ContextMenuStrip without stealing focus to current control? I would like to do sort of autocomplete with TextBox and ContextMenuStrip below it as list of options to choose. But whenever I show ContextMenuStrip it steals focus from textbox so I cannot catch Text_Changed again... I want to use ContextMenuStrip because I want to use pictures, or other other controls in list of given items.

Thanks

Not sure what you mean by 'cannot catch Text_Changed' again ? I would imagine something like this should work :

// event registered to text box's text changed event
private void HandlerForTextChanged() 
{
  // Get The Current Text So Far Filled In
  // Process and Show Contextmenu strip
  // Reset the focus back to text box (textbox1.SetFocus()) 
}

Also, can also think of re-designig the control as one composite control.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM