• <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 的底部

        Scroll to bottom of C# TextBox(滚动到 C# TextBox 的底部)
        • <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 的底部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to keep the Text of a Read only TextBox after PostBack()?(PostBack()之后如何保留只读文本框的文本?)
                  Winforms Textbox - Using Ctrl-Backspace to Delete Whole Word(Winforms 文本框 - 使用 Ctrl-Backspace 删除整个单词)
                  C# - Add button click events using code(C# - 使用代码添加按钮单击事件)
                  Multi-color TextBox C#(多色文本框 C#)
                  How can i set the caret position to a specific index in passwordbox in WPF(如何将插入符号位置设置为 WPF 密码框中的特定索引)
                  C# Numeric Only TextBox Control(C# 纯数字文本框控件)

                        <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>
                            <tbody id='7DCJg'></tbody>