如何使winform中richTextBox滚动条自己向下按一定的速度进行移动?
在线等高手解答

解决方案 »

  1.   

    [DllImport("user32")]
            private static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
            private void timer1_Tick(object sender, EventArgs e)
            {
                SendMessage(this.richTextBox1.Handle, 0x0115, 1, 0);
            }
      

  2.   

    using System.Runtime.InteropServices;
    timer控件的时间间隔自己设置一下就好了
      

  3.   

    不想用SendMessage()int lineIndex;
    private void timer1_Tick(object sender, EventArgs e)
            {            int charIndex = this.richTextBox1.GetFirstCharIndexFromLine(lineIndex++);
                this.richTextBox1.Select(charIndex, 0);
                this.richTextBox1.ScrollToCaret();
                
                int lineCount = this.richTextBox1.GetLineFromCharIndex(this.richTextBox1.TextLength - 1);
                if (lineIndex > lineCount)
                {
                    timer1.Stop();
                }
    }