• <legend id='R20ji'><style id='R20ji'><dir id='R20ji'><q id='R20ji'></q></dir></style></legend>
    1. <i id='R20ji'><tr id='R20ji'><dt id='R20ji'><q id='R20ji'><span id='R20ji'><b id='R20ji'><form id='R20ji'><ins id='R20ji'></ins><ul id='R20ji'></ul><sub id='R20ji'></sub></form><legend id='R20ji'></legend><bdo id='R20ji'><pre id='R20ji'><center id='R20ji'></center></pre></bdo></b><th id='R20ji'></th></span></q></dt></tr></i><div id='R20ji'><tfoot id='R20ji'></tfoot><dl id='R20ji'><fieldset id='R20ji'></fieldset></dl></div>

      <tfoot id='R20ji'></tfoot>

          <bdo id='R20ji'></bdo><ul id='R20ji'></ul>

        <small id='R20ji'></small><noframes id='R20ji'>

        如何在winform中允许带有TextBox的ctrl + a?

        时间:2023-06-09
          • <bdo id='2J5We'></bdo><ul id='2J5We'></ul>

            <small id='2J5We'></small><noframes id='2J5We'>

              • <legend id='2J5We'><style id='2J5We'><dir id='2J5We'><q id='2J5We'></q></dir></style></legend>

                    <tbody id='2J5We'></tbody>
                  <i id='2J5We'><tr id='2J5We'><dt id='2J5We'><q id='2J5We'><span id='2J5We'><b id='2J5We'><form id='2J5We'><ins id='2J5We'></ins><ul id='2J5We'></ul><sub id='2J5We'></sub></form><legend id='2J5We'></legend><bdo id='2J5We'><pre id='2J5We'><center id='2J5We'></center></pre></bdo></b><th id='2J5We'></th></span></q></dt></tr></i><div id='2J5We'><tfoot id='2J5We'></tfoot><dl id='2J5We'><fieldset id='2J5We'></fieldset></dl></div>

                  <tfoot id='2J5We'></tfoot>
                  本文介绍了如何在winform中允许带有TextBox的ctrl + a?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在这里问已经问过(甚至回答过)的问题:为什么有些文本框不接受 Control + A 快捷键默认全选

                  I'm asking the question already asked (and even answered) here: Why are some textboxes not accepting Control + A shortcut to select all by default

                  但是这个答案对我不起作用.我有这个代码:

                  But that answer doesn't work for me. I have this code:

                  public class LoginForm : Form
                  {
                      private TextBox tbUsername;
                  
                      public LoginForm()
                      {
                          tbUsername = new TextBox();
                          tbUsername.ShortcutsEnabled = true;
                          tbUsername.Multiline = false;
                          Controls.Add(tbUsername);
                      }
                  }
                  

                  文本框出现,我可以在上面写字,我可以在上面剪切、复制和粘贴文本,没有任何问题.但是,当我尝试按 Ctrl+A 时,我只会听到类似于您尝试从空文本框中删除文本时听到的bling"(尝试一下)使用浏览器的地址栏).

                  The textbox shows up, I can write on it, I can cut, copy and paste text on it without any problems. But when I try to press Ctrl+A I only hear a "bling" similar to the bling that you hear if you try to erase text from an empty textbox (try it with your browser's address bar).

                  推荐答案

                  如其他答案所示,应该调用 Application.EnableVisualStyles().此外,TextBox.ShortcutsEnabled 应设置为 true.但是如果您的 TextBox.Multiline 已启用,那么 Ctrl+A 将不起作用(参见 MSDN 文档).使用 RichTextBox 可以解决这个问题.

                  Like other answers indicate, Application.EnableVisualStyles() should be called. Also the TextBox.ShortcutsEnabled should be set to true. But if your TextBox.Multiline is enabled then Ctrl+A will not work (see MSDN documentation). Using RichTextBox instead will get around the problem.

                  这篇关于如何在winform中允许带有TextBox的ctrl + a?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:从动态添加的文本框中获取值 asp.net c# 下一篇:当内容超出范围时在文本框中显示滚动条C#

                  相关文章

                  • <bdo id='UHTnU'></bdo><ul id='UHTnU'></ul>

                  <small id='UHTnU'></small><noframes id='UHTnU'>

                • <i id='UHTnU'><tr id='UHTnU'><dt id='UHTnU'><q id='UHTnU'><span id='UHTnU'><b id='UHTnU'><form id='UHTnU'><ins id='UHTnU'></ins><ul id='UHTnU'></ul><sub id='UHTnU'></sub></form><legend id='UHTnU'></legend><bdo id='UHTnU'><pre id='UHTnU'><center id='UHTnU'></center></pre></bdo></b><th id='UHTnU'></th></span></q></dt></tr></i><div id='UHTnU'><tfoot id='UHTnU'></tfoot><dl id='UHTnU'><fieldset id='UHTnU'></fieldset></dl></div>

                      <legend id='UHTnU'><style id='UHTnU'><dir id='UHTnU'><q id='UHTnU'></q></dir></style></legend>
                      <tfoot id='UHTnU'></tfoot>