如何自动向上滚动texbox中的文本 [英] How to Scroll up the Text in texbox automatically

查看:267
本文介绍了如何自动向上滚动texbox中的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

上传文本文件后,在文本框中显示文本.当到达光标的最后一行时,应使用计时器控件自动向上滚动文本.

After upload the Textfile text display in textbox. when reach the cursor last line text should be scroll up automatically using timer control.

public partial class Form1 : Form
  {
      DateTime dt1, dt2;

      public Form1()
      {
          InitializeComponent();
      }

      private void btnLoad_Click(object sender, EventArgs e)
      {
          OpenFileDialog openFile1 = new OpenFileDialog();

          openFile1.Filter = "Text Files|*.txt";
          dt1 = DateTime.Now;


          if (openFile1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
              richTextBox1.LoadFile(openFile1.FileName,
              RichTextBoxStreamType.PlainText);
      }
  }


这是我的代码如何将文本排列起来

[edit]已添加代码块-OriginalGriff [/edit]


here is my code how to scoll the text up

[edit]Code block added - OriginalGriff[/edit]

推荐答案

这是一个解决方案,但您需要从计时器滴答事件中调用send message方法

每次调用以下方法时,它将向上移动一行
Here is a solution but you need to call send message method from your timer tick event

Each time you call following method it will move one line up
SendMessage(richTextBox1.Handle, (uint)0x00B6, (UIntPtr)0, (IntPtr)(-1));



http://stackoverflow. com/questions/205794/如何在c-sharp-richtextbox中一行移动滚动条



http://stackoverflow.com/questions/205794/how-to-move-scroll-bar-up-by-one-line-in-c-sharp-richtextbox


这篇关于如何自动向上滚动texbox中的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆