是否正在拖动外部窗口?
我有一个程序可以使窗口卡入指定位置和大小的插槽中。您可以拖动一个窗口,完成拖动后它将捕捉到最近的插槽。我想添加的是当拖动发生时窗口将移动到的插槽的覆盖层。
捕捉和覆盖效果很好。我的问题是我需要一种更好的方法来知道窗口是否被拖动。我防止窗口在拖动时捕捉到插槽的方法是在单击鼠标时不执行任何操作。单击鼠标时绘制覆盖层是可行的,但会导致只要单击鼠标,即使正在拖动窗口,也会显示覆盖层。
有没有一种方法可以接受 hwnd 并告诉我该窗口是否被拖动?或者有更好的方法来完成这个过程吗?
I have a program that causes windows to snap into slots that specify a location and size. You can drag a window and then it will snap to the closest slot when you finish the drag. What I want to add is an overlay of the slot that the window will be moved to as the drag is happening.
The snapping and the overlay work fine. My problem is that I need a better way to know if the window is being dragged. The way I was preventing a window from snapping to slot while a drag was happening is by just not doing anything while the mouse was clicked. Drawing the overlay while the mouse is clicked works, but causes the overlay to show up anytime the mouse is clicked even if a window is being dragged.
Is there a method that will take a hwnd and tell me if that window is being dragged? Or is there a better way go about this process?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于我找不到任何东西,也没有人提出任何建议,所以我最终写了一些近似的东西。 Win32 是我的静态类,它处理所有 DllImport 和 struct 定义以与 user32.dll 交互。
Since I couldn't find anything and nobody came up with any suggestions, I ended up writing something that approximates it. Win32 is my static class that handles all the
DllImport
s andstruct
definition to interact withuser32.dll
.