如何防止菜单 (ContextMenuStrip) 窃取 TextBox 控件的焦点?

发布于 2024-12-21 09:53:33 字数 225 浏览 6 评论 0原文

我正在尝试复制类似智能感知的功能,其中有一个文本框和一个显示在其下方的菜单。我知道智能感知不使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

绝不放开 2024-12-28 09:53:33

添加了项目的 ToolStrip 控件似乎可以工作,因为它始终位于窗体上。

ToolStrip control with items added to it seems to work since it's always on the form.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文