问题描述
我有一个项目使用 C# winforms 已经有一段时间了.我在 Windows 7 发布之前实现了拖放功能.像魅力一样工作.但是,当使用 Windows 7 时,它不起作用.该事件甚至没有被触发.
I have had a project for quite a while using C# winforms. I implemented a drag-drop function before windows 7 was released. Worked like a charm. However, when using windows 7 it does not work. The event doesn't even get triggered.
AllowDrop
设置为 true.订阅 DragEnter
时,它不会在 Windows 7 中调用(不确定 vista).但在 XP 上它一直有效.该程序以管理员权限运行.
AllowDrop
is set to true. When subscribing to DragEnter
it does not get called in windows 7 (not sure about vista). But on XP it works all the way. The program is run with administritave priviliges.
windows 7 和 xp 中的拖放有什么不同吗?不知道是否相关,但我使用的是 x64
Is there any difference in the drag drop in windows 7 vs xp? Don't know if it's relevant, but I'm using x64
推荐答案
源进程和目标进程需要具有兼容的安全级别/权限.例如,如果您的源是 Explorer 并且它以用户级别权限运行,但您的目标应用程序以管理员(提升)级别权限运行,您将无法拖放,因为这被视为安全问题,因为目标正在以更高级别的权限运行.
The source and target processes need to have compatible security levels/privileges. For example, if your source is Explorer and it is running with user level privileges, but your target application is running with administrator (elevated) level permission, you will not be able to drag&drop as this is seen as a security issue as the target is running with a higher level of privileges.
这篇关于C# 拖放在 Windows 7 上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!