检查是否在Windows形成滚动条滚动一路下跌? [英] Checking if a Windows forms scroll bar is scrolled all the way down?

查看:96
本文介绍了检查是否在Windows形成滚动条滚动一路下跌?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个作为记录了丰富的文本框。当一个新的消息被追加,这是很好的日志自动滚动自行关闭。唯一的问题是,当用户希望从之前查看的东西在日志中;如果有新的消息被追加,包装盒自动滚动一路下来,prevents无法看到任何东西的用户。 我想能够检查丰富的文本框滚动一路下来,如果不是不向下滚动。

I have a rich text box which serves as a log. The log automatically scrolls itself down when a new message is appended, which is good. The only problem is when the user wants to view something in the log from before; if a new message is appended, the box automatically scrolls all the way down and prevents the user from seeing anything. I would like to be able to check if the rich text box is scrolled all the way down, and if it isn't not scroll down.

目前我可以在虚拟空间文本(SendMessage函数与EM_GETSCROLLPOS)滚动位置。我还可以得到与GetScrollBarInfo PInvoke的滚动条信息。但我怎么找出虚拟空间文本的底部?

Currently I can get the scroll position in the virtual text space (SendMessage with EM_GETSCROLLPOS). I can also get scroll bar info with GetScrollBarInfo pinvoke. But how do I figure out what the bottom of the virtual text space is?

谢谢!

推荐答案

使用 vScrollBar 控制你的的RichTextBox 而处理其Scroll事件

Use a vScrollBar control for your RichTextBox and handle its Scroll event

    private void vScrollBar1_Scroll(object sender, ScrollEventArgs e)
    {
        if (e.Type == ScrollEventType.Last)
        {
            //scrollbar is all the way down
        }
        else
        {
            //user has scrolled up
        }
    }

这篇关于检查是否在Windows形成滚动条滚动一路下跌?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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