Check Windows scrollbar scroll backward?

I have a rich text box that serves as a magazine. The log automatically scrolls when a new message is added, which is good. The only problem is when the user wants to see something in the log before; if a new message is added, the window automatically scrolls down and does not allow the user to see anything. I would like to be able to check if the full-text field scrolls to the end, and if it does not scroll down.

Currently, I can get the scroll position in virtual text space (SendMessage with EM_GETSCROLLPOS). I can also get scrollbar information using pinvoke GetScrollBarInfo. But how do I understand what the bottom of virtual text space is?

Thank!

+5
source share
1 answer

Use an item vScrollBarfor yours RichTextBoxand 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
        }
    }
+2
source

All Articles