树视图MouseLeave事件触发时移过滚动条视图、滚动条、事件、MouseLeave

2023-09-07 00:30:40 作者:≈。彩虹

在树视图,列表框,或似乎从我的谷歌搜索有滚动条的话,就是滚动条不被视为控制的一部分。

In the TreeView, ListBox, or it seems from my google searches anything with a ScrollBar, the ScrollBar is not considered a part of the control.

我有我投入自定义控件一个TreeView,它的底座填写。所以它作为一个自定义的TreeView里面有我们所有的逻辑,在一个地方管理。

I have a TreeView that I'm putting into a custom control, and it's Dock Fill. So there it acts as a custom TreeView which has all our logic to manage it in one place.

在我们的计划的一部分,我们是基于一个MouseEnter事件滑出,并在mouseLeave事件滑回,但我们目前使用的第三方库的树视图对于这一点,我一直负责更换。

In parts of our program we slide it out based on a MouseEnter event, and slide it back in on a MouseLeave event, however we are currently using a 3rd party library's TreeView for this, which I have been tasked with replacing.

所以,我感动了所有到Windows树视图,但不能找到一种方法,可靠的捕捉鼠标离开-only-如果离开整个树视图,滚动条包括在内。

So I've moved everything over to the Windows TreeView, but can not find a way to reliable capture the MouseLeave -only- if it leaves the entire TreeView, scrollbar included.

我看到包装在一个小组与几个像素,捕捉面板的鼠标离开的一个hackish的解决办法,但我很难相信这是微软原本打算我们做的这种情况。

I've seen one hackish solution of wrapping it in a panel with several pixels and capturing the MouseLeave of the panel, but I hardly believe this is what Microsoft had intended us to do in this situation.

简而言之:

的滚动条不火的MouseEnter或鼠标离开的控制,这使得使用的MouseEnter /鼠标离开滑动了控制,因为用户无法使用滚动条无法使用。

什么是preferred的方式来处理这种情况?

What is the preferred way to handle this situation?

推荐答案

火了间谍++和选择树视图窗口。将鼠标上的滚动条。大量的活动有,WM_NCMOUSEMOVE看起来像一个很好的给我。抓住它的WndProc()中覆盖。

Fire up Spy++ and select the Treeview window. Move the mouse on the scrollbar. Plenty of activity there, WM_NCMOUSEMOVE looks like a good one to me. Catch it in a WndProc() override.