I bear this question due to the inability to solve the problem (original here ).
In a TreeView, ListBox, or it seems from my Google search nothing with a ScrollBar, the ScrollBar is not considered part of the control.
I have a TreeView that I put in a custom control, and this is a Dock Fill. Thus, it acts as a custom TreeView, which has all our logic for managing it in one place.
In some parts of our program, we push it based on the MouseEnter event and put it back into the MouseLeave event, however, we are currently using the third-party TreeView library for which I was instructed to replace.
So, I moved everything to Windows TreeView, but I can’t find a way to reliably capture MouseLeave - only if it leaves the entire TreeView, including the scroll bar.
I saw one hacker decision to wrap it on a panel with several pixels and capture MouseLeave panels, but I hardly believe what Microsoft intended to do in this situation.
In short:
The ScrollBar does not start the MouseEnter or MouseLeave for the control, and this makes using MouseEnter / MouseLeave to turn off the control unusable because the user cannot use the ScrollBar.
What is the preferred way to deal with this situation?
In a previous question, I was given advice on using Spy ++ and trying to connect to WndProc () to handle MouseEnter / MouseLeave for a ScrollBar.
, , Spy ++, WndProc() . .NET ScrollBar.
WndProc() , , WndProc() - , - , ?