如何编写两个按钮以向上和向下滚动到 RichTextBox 中?我尝试什么:
private void btnScrollTop_Click(object sender, EventArgs e) {
if (rtbDefinitie.SelectionStart >= 30) {
rtbDefinitie.SelectionStart -= 30;
rtbDefinitie.ScrollToCaret();
}
}
private void btnScrollBottom_Click(object sender, EventArgs e) {
if (rtbDefinitie.SelectionStart <= 30) {
rtbDefinitie.SelectionStart += 30;
rtbDefinitie.ScrollToCaret();
}
}
但是在我按两次向下滚动按钮后,它似乎卡住了。我需要做什么 ?