Enter 时的 toolStripTextBox 操作

发布于 2024-10-30 13:12:59 字数 255 浏览 4 评论 0原文

在 C# Winforms 应用程序中,我使用“toolStripTextBox”工具条控件来捕获一些文本,这些文本将用于过滤表单上的其他一些内容。

从“toolStripSplitButton”中选择“toolStripTextBox”。

用户可以激活文本框并输入文本,但我很难控制用户输入的结束。我希望用户按 ENTER 来完成输入。

我可以检测到已通过按键事件按下了“ENTER”,但这不会将焦点从文本框移开。

有什么想法吗?

In a C# Winforms application, I am using a "toolStripTextBox" toolstrip control to capture some text that is to be used to filter some other content on the form.

The "toolStripTextBox" is selected from a "toolStripSplitButton".

The user can activate the textbox and enter text, but I am struggling to control the end of the user input. What I would like is for the user to press ENTER to complete the input.

I can detect that "ENTER" has been pressed with the key pressed events, but this does not remove the focus away from the text box.

Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

余生共白头 2024-11-06 13:12:59

要将焦点发送到下一个控件,请在同一事件上尝试以下代码

    e.Handled = true;
    System.Windows.Forms.SendKeys.Send("{TAB}"); // optional

to send the focus to next control try the below code on same event

    e.Handled = true;
    System.Windows.Forms.SendKeys.Send("{TAB}"); // optional
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文