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

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

        滚动到 C# TextBox 的底部

        时间:2023-06-08
        • <bdo id='Q9Aol'></bdo><ul id='Q9Aol'></ul>

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

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

                • <legend id='Q9Aol'><style id='Q9Aol'><dir id='Q9Aol'><q id='Q9Aol'></q></dir></style></legend>

                  <tfoot id='Q9Aol'></tfoot>

                  本文介绍了滚动到 C# TextBox 的底部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在 C# 表单应用程序上有一个文本框.我用有关表单的 Load 事件的信息填充 TextBox.然后我调用以下命令:

                  I have a TextBox on a C# Forms Application. I populate the TextBox with information on the Load event of the form. I then call the following:

                  this.txtLogEntries.SelectionStart = txtLogEntries.Text.Length;
                  this.txtLogEntries.ScrollToCaret();
                  

                  但是 TextBox 没有滚动到底部?

                  However the TextBox does not scroll to the bottom ?

                  这仅适用于 Load 事件.一旦它运行,我还会从应用程序的其他部分更新此 TextBox,一旦这些事件之一更新为 TextBox,它就会滚动到底部.

                  This only applies to the Load event though. I also update this TextBox from other parts of the application once it's running, and as soon as one of these events update's the TextBox, it is scrolled to the bottom.

                  那么,在表单加载事件中预填充文本框时,如何让它滚动到底部?

                  So, how can I get it to scroll to the bottom when pre populating the TextBox in the Form Load event?

                  推荐答案

                  尝试将代码放在 Form 的 Shown 事件中:

                  Try putting the code in the Form's Shown event:

                  private void myForm_Shown(object sender, EventArgs e)
                  {
                    txtLogEntries.SelectionStart = txtLogEntries.Text.Length;
                    txtLogEntries.ScrollToCaret();
                  }
                  

                  这篇关于滚动到 C# TextBox 的底部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:带有用户名数据的 AutoCompleteCustomSource 不起作用 下一篇:在 TextBox 控件中创建超链接

                  相关文章

                      <small id='7DCJg'></small><noframes id='7DCJg'>

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

                        <bdo id='7DCJg'></bdo><ul id='7DCJg'></ul>