Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 各种剪贴板/拖放格式意味着什么?_.net_Windows_Drag And Drop_Clipboard - Fatal编程技术网

.net 各种剪贴板/拖放格式意味着什么?

.net 各种剪贴板/拖放格式意味着什么?,.net,windows,drag-and-drop,clipboard,.net,Windows,Drag And Drop,Clipboard,我在玩拖放游戏。我制作了一个示例应用程序,并将文件夹中的一个文件放到我的应用程序中。下面是e.Data.GetFormats()返回的内容: Shell IDList数组 使用默认绘图 龙舌兰钻头 DragContext DragSourceHelperFlags 英舍尔德拉格洛普酒店 文件删除 文件名 文件名 是分层的吗 拉格温多 计算机时代 DropDescription 禁用DragText 计算绘图 IsShowingText 这些都意味着什么?如何解码和使用它们 谷歌搜索每一个文件

我在玩拖放游戏。我制作了一个示例应用程序,并将文件夹中的一个文件放到我的应用程序中。下面是
e.Data.GetFormats()
返回的内容:

  • Shell IDList数组
  • 使用默认绘图
  • 龙舌兰钻头
  • DragContext
  • DragSourceHelperFlags
  • 英舍尔德拉格洛普酒店
  • 文件删除
  • 文件名
  • 文件名
  • 是分层的吗
  • 拉格温多
  • 计算机时代
  • DropDescription
  • 禁用DragText
  • 计算绘图
  • IsShowingText
这些都意味着什么?如何解码和使用它们


谷歌搜索每一个文件都没有产生任何有用的信息。

FileDrop是标准的,由DataFormats类覆盖。Shell IDList和FileName/W是Windows资源管理器的常用命令。其余的都是习俗。从他们的名字来看,当你拖动到其他微软应用程序(如Media Player)时,他们似乎增强了D+D反馈。此内容的文档记录很差,可能是故意的。

DragImageBits描述了拖动内容时显示的图像。其标题由描述

var data=e.data.GetData(“DragImageBits”)作为内存流;
var buffer=新字节[24];
数据读取(缓冲区,0,24);

int w=buffer[0]+(buffer[1]+1-我使用了一些代码来获得一个不同的答案:虽然这是可行的,但可以通过使用二进制读取器来简化。我在绘制颜色时遇到麻烦。大多数颜色与原始颜色完全匹配,但白色区域显示为灰色?
var data = e.Data.GetData("DragImageBits") as MemoryStream;
var buffer = new byte[24];
data.Read(buffer, 0, 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, 96, PixelFormats.Bgra32, null, buffer, stride);