我可以为 C# Windows 应用程序拖放功能选择自定义图像吗? [英] Can I choose a custom image for C# Windows Application Drag Drop functions?

查看:24
本文介绍了我可以为 C# Windows 应用程序拖放功能选择自定义图像吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个小项目,我想利用拖放功能来简化最终用户的一些操作.为了使应用程序更具吸引力,我想显示被拖动的对象.我找到了一些关于 WPF 的资源,但我不知道任何 WPF,所以对于这个单一任务来说,咬住整个主题变得有点困难.我想知道如何使用常规"C# Windows 窗体来做到这一点.到目前为止,我发现的所有拖放教程都只是谈论拖放效果,这只是几个图标的预设.

I am writing a small project where I would like to make use of drag and drop functionalty to ease some of the operations for the end user. To make the application a little more appealing, I would like to display the object being dragged. I have found some resources with WPF, but I don't know any WPF, so it becomes a bit tough to bite down on that whole subject for this single task. I would like to know how this can be done with "regular" C# Windows Forms. So far, all drag drop tutorials I've found just talk about the drop effects which is just a preset of a few icons.

WPF 听起来像是我想在这个项目之后学习的东西.

WPF sounds like something I want to learn after this project.

推荐答案

您需要隐藏默认光标并创建包含自定义图像的窗口,然后使用鼠标位置移动该窗口.

You need to hide the default cursor and create your own window containing your custom image and then move that window with the position of the mouse.

您还可以查看 http://web.archive.org/web/20130127145542/http://www.switchonthecode.com/tutorials/winforms-using-custom-cursors-with-drag-drop

2015 年 11 月 26 日更新

更新了指向 archive.org 的最后一个快照的链接

Updated the link to point to archive.org's last snapshot

这篇关于我可以为 C# Windows 应用程序拖放功能选择自定义图像吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆