如何在拖放时隐藏窗口中的光标(可能用Python或其他语言)
经过几个小时的谷歌搜索后,运气不佳,我想知道是否有人知道如何在拖放时隐藏光标,或在 Windows 中设置自定义光标(可以设为空白)。
我正在编写一个使用openGL绘制自己的鼠标的程序,通常鼠标隐藏得很好,但是当我将文件拖到程序的窗口上时,窗口光标显示拖放方块并且不会隐藏。 ShowCursor(False) 和 SetCursor(None) (在 python 中)对于隐藏光标不一致。
理想情况下,如果有人知道如何使用 pywin32 在 Python 中执行此操作,那将是理想的,因为这是我的项目正在使用的语言,但如果我必须用另一种语言进行编码,我会的。
或者,如果有人知道 ShowCursor 和 SetCursor 何时保证隐藏光标,无论这是否与窗口焦点或相关内容有关,这也会有所帮助。
我找到了此页面: http: //msdn.microsoft.com/en-us/library/system.windows.forms.control.dodragdrop.aspx#Y1354 我无法编译 C++ 代码,并且在使用 C# 和 VB 版本时出现异常。我已将光标从 C:\Windows\Cursors 复制到可执行文件为 3dwarro.cur 和 3dwno.cur 的目录。当我注释掉 try 子句时,当它尝试加载游标时,它说它们已损坏。
我还找到了此页面: http://www.rockhoppertech.com /java-drag-and-drop-faq.html。它表示将 DragContext 的光标设置为 null,然后设置为 DragOver 中的光标。该页面是用 Java 编写的,我不知道该怎么做。
非常感谢!
After hours of searching google, with little luck, I'm wondering if anybody knows how to either hide the cursor, or set a custom cursor (which could be made blank) in Windows when dragging and dropping.
I'm writing a program which draws its own mouse using openGL, and normally the mouse hides just fine, but when I drag files onto the program's window, the windows cursor shows the drag-and-drop square and will not hide. ShowCursor(False) and SetCursor(None) (in python) are inconsistent for hiding the cursor.
Ideally, if anybody knew how to do this in Python using pywin32, that would be ideal, as that's the language my project is using, but if I have to code this up in another language I will.
Alternately, if anybody knows when ShowCursor and SetCursor will guarantee to hide the cursor, whether this has to do with window focus or something related, that would also be helpful.
I've found this page: http://msdn.microsoft.com/en-us/library/system.windows.forms.control.dodragdrop.aspx#Y1354
I cannot get the C++ code to compile, and I get exceptions when I use the C# and VB versions. I've copied cursors from C:\Windows\Cursors to the directory with the executable as 3dwarro.cur and 3dwno.cur. When I comment out the try clauses, when it tries to load the cursors it says they are corrupt.
I've also found this page: http://www.rockhoppertech.com/java-drag-and-drop-faq.html. It says to set the DragContext's cursor to null and then to your cursor in dragOver. The page is in Java, and I don't know how to do what it is saying.
Many thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Windows SDK:
所以你应该尝试等效的:
Windows SDK:
So you should try the equivalent of: