我正在尝试使用具有以下要求的多行TextBox创建表单:
所以我正在尝试制作一个“完全查看”的多行TextBox。
这张照片应该清楚我要做的事情:
如果他们在滚动整个事情之前检查了复选框,我就会知道不相信它们。
我想我需要知道:
有关如何实现这一目标的任何想法?
答案 0 :(得分:2)
TextBox
没有滚动事件,RichTextBox
有。它还有一个方法,可以让你获得最接近点位置的字符索引。
private readonly Point _lowerRightCorner;
public frmDetectTextBoxScroll()
{
InitializeComponent();
_lowerRightCorner = new Point(richTextBox1.ClientRectangle.Right,
richTextBox1.ClientRectangle.Bottom);
}
private void richTextBox1_VScroll(object sender, EventArgs e)
{
int index = richTextBox1.GetCharIndexFromPosition(_lowerRightCorner);
if (index == richTextBox1.TextLength - 1) {
// Enable your checkbox here
}
}