如何防止菜单 (ContextMenuStrip) 窃取 TextBox 控件的焦点?
我正在尝试复制类似智能感知的功能,其中有一个文本框和一个显示在其下方的菜单。我知道智能感知不使用 ContextMenuStrip,但我的版本必须具有子菜单项的类别。
因此,一旦用户单击我的文本框,我就会调出下面的菜单一次,但即使我可以在文本框中看到插入符号,它也不会收到任何按键输入。我必须再次单击文本框内部,但这会从屏幕上删除菜单。
有办法防止这种情况吗?或者也许让菜单永久显示在屏幕上而不窃取焦点?
I am trying to replicate an intellisense like feature where you have a textbox and a menu that's shown below it. I know intellisense doesn't use ContextMenuStrip, but my version has to have categories which are sub-menu items.
So as soon as the user clicks into my TextBox, I bring up the menu below once, but then even though I can see the caret in my TextBox it doesn't receive any key inputs. I have to click inside the TextBox again but that removes the menu from the screen.
Is there a way to prevent this? Or perhaps make the menu persistent on the screen without stealing focus?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
添加了项目的 ToolStrip 控件似乎可以工作,因为它始终位于窗体上。
ToolStrip control with items added to it seems to work since it's always on the form.