JanRad
JanRad

Reputation: 327

Winforms Rich Textbox allow scrolling when mouse over

I have simple chat application with Rich Textbox to display messages and Textbox to write them. I'd like to have same behaviour as facebook chat does, which is having focus on the Textbox but being able to use mouse wheel to scroll the one I'm hovering over. So as an example: I'm writting something in the Textbox but in the meantime I want to scroll the Rich Textbox upwards by using my mousewheel without loosing focus on the Textbox. Facebook chat has this exact behaviour.

Semi pseudo code I came up with:

    private void richTextBox_MouseOver(object sender, EventArgs e)
    {
        MouseWheelScroll -> richTextBox scroll, msgTextBox don't scroll
    }

Upvotes: 2

Views: 942

Answers (1)

Tommaso Cerutti
Tommaso Cerutti

Reputation: 495

  • I confirm Dmitriy Zapevalov's insight, Windows 10 Operative System has a new interesting feature:

    Scroll inactive windows when I hover over them

    This is exactly the behaviour you desire, I can confirm it works both in Winform and WPF application and in general it is the behaviour of any window I see on my monitor. It is enabled by default, user can disable it.

  • It is a little bit tricky to reproduce that on c# applications running on windows Xp, Vista, 7 or Windows 8, you can find that issue solved in C++ here and in manuell answer here

Upvotes: 1

Related Questions