i have a multiline textbox in my app and when i middle-click to scroll up or down, it doesn't work.
It works in Notepad, but not in my textbox. Does anybody know why? or, if it is possible to programatically begin scrolling in the desired direction when the middle-button's clicked?
To get the mouse wheel scroll thing to work, make your own custom TextBox class that inherits TextBox.
Override the WndProc method.
Look at the message type.
For Message type 0x207 (WM_MBUTTONDOWN), call DefWndProc(ref m); For any other message type, call base.WndProc(ref m);
Then your text box will have middle button scroll.
Normally Windows.Forms overrides the built-in middle button feature of the textbox so the control can have a MouseDown event on the middle button, but that also disables the innate scroll feature. Go back to calling the default window handler, and the textbox gets its scroll feature back.
Do you have the
ScrollBars
property set toVertical
orBoth
?For me it's not working only when
ScrollBars = None
orHorizontal