C# 拖放到应用程序任务栏图标

发布于 2024-09-27 07:21:17 字数 116 浏览 10 评论 0原文

是否可以将(文件、文本)拖放到 WindowsForms 应用程序 (C#) 的任务栏图标上?

我知道对于托盘图标没有简单的方法(它涉及使用 Win32 API 和挂钩),但我想知道对于任务栏是否可以。

Is it possible to drag and drop (files, text) to the taskbar icon of a WindowsForms application (C#)?

I know there's no easy way to do it for the tray icon (it involves using Win32 API and hooks), but I was wondering if it's possible for the taskbar.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

岁吢 2024-10-04 07:21:17

这是不可能的,但窗口管理器会自动如果您将鼠标悬停在任务栏中的窗口上足够长的时间,则会恢复最小化的窗口。恢复后,您可以访问窗口实现的所有放置目标。

That's not possible, but the window manager automatically restores the minimized window if you hover over it long enough in the taskbar. Once restored, you can access all the drop targets your window implements.

紙鸢 2024-10-04 07:21:17

这是可能的,至少在 Windows 7 中是可能的。请注意,两个旧答案引用的博客文章来自 2004 年。在 Windows 7 和可能以前的版本中,可以将文件拖放到应用程序上如果您在放下时按住 Shift 键,则会出现任务栏。支持此功能的应用程序示例有 Firefox、Internet Explorer、记事本等。

为了支持它,您的 exe 需要能够支持命令行 myapp.exe < Strike>,我相信您需要类似于 这个答案

更新:

我将其添加到我的一个应用程序中,并且它有效。您不需要注册表项。

It is possible, at least in Windows 7. Note that the blog post which the two older answers refer to is from 2004. In Windows 7 and possibly previous versions, it is possible to drop files onto applications on the taskbar if you hold shift while dropping. Examples of applications that support this are Firefox, Internet Explorer, Notepad, etc.

In order to support it, your exe needs to be able to support the command line myapp.exe <some file path> and I believe you need registry entries similar to those described in this SO answer.

Update:

I added this to one of my applications, and it works. You do not need the registry entries.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文