8

I have implemented drag and drop in a ListView in my WPF application. Items can be dragged and dropped inside the ListView, and also into a TreeView that is beside the ListView.

Currently, I have it set up so that when you drag to the bottom of the ListView, it automatically scrolls down the list.

What I'd like to know is if there's any way to be able to scroll through the ListView with the mouse wheel while I'm dragging its items? It seems like the mouse wheel events aren't being fired while I'm dragging.

4

1 回答 1

0
  1. 在之前创建(并启动)鼠标钩子助手DragDrop.DoDragDrop(...)
  2. 分析鼠标滚轮(+检查鼠标是否在控制上)
  3. DoDragDrop()操作后停止(处置)鼠标钩子助手

注意:总是停止鼠标钩子助手,因为它可以在关闭窗口时冻结应用程序(我在 XP 上看到它)。

在这里你可以找到一个 MouseHook,采用它(我发现了 bug :))或类似的东西。

于 2015-09-13T10:49:54.447 回答