ScrollBar does not scroll Select ()

I will focus on the scrollbar with vScrollBar.Select(); The scrollbar becomes focused, but it does not scroll with the mouse wheel.

It scrolls only if the mouse cursor is above the scroll bar.

How do I scroll the scrollbar after Select () without placing the cursor on the scrollbar?

Environment: Windows 10, Windows Forms, .NET 4.0

EDIT

I noticed that the scrollbar scrolls correctly when I โ€œscrollโ€ with two fingers on the touchpad of a laptop, but not with the mouse wheel. Is it possible that the problem is with the Windows 10 mouse / touchpad driver?

+4
source share
3 answers

I just got Win10 and confirmed. This is a side effect of the new Windows 10 feature configured in Settings> Devices> Mouse and Touchpad. It is called "Scrolling inactive windows when I hover over them", it is enabled by default. This web page mentions this.

In fact, this is a very nice feature, I personally will definitely save it, and most likely your users will also be. Previous versions of Windows sent messages with the mouse wheel to the control with focus, which led to the fact that many users began to get used to the way the mouse behaves, say, in the browser. Note that the scroll bar helps; it redraws the thumb to indicate that it is no longer active when you move the mouse from the panel.

Committing is technically possible; you will have to redirect the message back to the scroll bar. Nothing special:

  public Form1() { InitializeComponent(); panel1.MouseWheel += RedirectMouseWheel; } private bool redirectingWheel; private void RedirectMouseWheel(object sender, MouseEventArgs e) { if (this.ActiveControl != sender && !redirectingWheel) { redirectingWheel = true; SendMessage(this.ActiveControl.Handle, 0x020A, new IntPtr(e.Delta << 16), IntPtr.Zero); redirectingWheel = false; var hmea = (HandledMouseEventArgs)e; hmea.Handled = true; } } [System.Runtime.InteropServices.DllImport("user32.dll")] private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wp, IntPtr lp); 

But do not skip weapons, your users tend to expect Win10 behavior, in the end :)

+8
source

To use the Winforms scrollbar with the mouse wheel, not the Select() scrollbar itself, you need to select the panel, image, or whatever you made it scrollable.

0
source

Not sure if you guys have problems with the mouse in the new Windows 10. I had a lot of problems with pf, a lot of research and setting changes. Tried everything that was recommended. All this in Explorer. I switched to Mozilla Firefox and have no problems at all. Everything works perfectly. Maybe an option for you to consider. If you use Firefox and have a problem, you donโ€™t know. Good luck

-one
source

All Articles