微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

各种剪贴板/拖放格式是什么意思?

我正在玩拖放。 我做了一个示例应用程序,并从我的音乐文件夹中删除一个文件到我的应用程序 以下是e.Data.GetFormats()返回的内容

Shell IDList Array

UsingDefaultDragImage

DragImageBits

DragContext

DragSourceHelperFlags

InShellDragLoop

FileDrop

FileNameW

文件

IsShowinglayered

DragWindow

IsComputingImage

DropDescription

disableDragText

ComputedDragImage

IsShowingText

这些都意味着什么,以及如何解码和使用它们?

谷歌search他们每个人没有得到任何有用的信息。

获取Windows版本

连接到没有用户名/密码的远程机器

在Windows中比在Linux中慢的端口监听?

Windows Xperf diskio操作不会显示一个程序在性能跟踪会话期间读取的文件

#if(DEBUG)在定制的基类库中不起作用

C#:什么是最快的方式来生成一个唯一的文件名?

我可以在Windows上加载一个32位DLL到64位进程吗?

如何更改Windows Service环境path

在Metro应用程序中使用C#保存用户设置

运行ProgId动词的命令

FileDrop是标准的,由DataFormats类覆盖。 Windows资源管理器通常使用Shell IDList和FileName / W。 其余的都是自定义的。 按照他们的名字,这听起来像是当你拖动到其他微软应用程序,如媒体播放器时,他们增强了D + D反馈。 这些东西记录不完整,可能是故意的。

DragImageBits描述当您拖动东西时显示的图像。 它的头由SHDRAGIMAGE描述。

var data = e.Data.GetData("DragImageBits") as MemoryStream; var buffer = new byte[24]; data.Read(buffer,24); int w = buffer[0] + (buffer[1] << 8) + (buffer[2] << 16) + (buffer[3] << 24); int h = buffer[4] + (buffer[5] << 8) + (buffer[6] << 16) + (buffer[7] << 24); // Stride accounts for any padding bytes at the end of each row. For 32 bit // bitmaps there are none,so stride = width * size of each pixel in bytes. int stride = width * 4; // x and y is the relative position between the top left corner of the image and // the mouse cursor. int x = buffer[8] + (buffer[9] << 8) + (buffer[10] << 16) + (buffer[11] << 24); int y = buffer[12] + (buffer[13] << 8) + (buffer[14] << 16) + (buffer[15] << 24); buffer = new byte[stride * h]; // The image is stored upside down,so we flip it as we read it. for (int i = (h - 1) * stride; i >= 0; i -= stride) data.Read(buffer,i,stride); BitmapSource.Create(w,h,96,PixelFormats.Bgra32,null,buffer,stride);

还是应该使用DragDropHelper来代替更好的兼容性。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐