Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.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
C# 如何从字节数组中解析多段线图元文件记录?_C#_Metafile - Fatal编程技术网

C# 如何从字节数组中解析多段线图元文件记录?

C# 如何从字节数组中解析多段线图元文件记录?,c#,metafile,C#,Metafile,在C中定义以下Windows GDI类型时,我需要一些帮助。我在C中有字节[]形式的数据,我需要以某种方式在C中封送或强制转换它,如下所示。我想我需要定义正确的结构?这是一种: 名称 最近的API调用 描述 多段线是点的列表。与多边形不同,多段线总是未填充的,并且可以打开。您查看了吗?好的,多段线的图元文件记录。。。您可能希望尝试执行从字节数组到UInt16数组的转换 未经测试谢谢大家。假设在我的Graphics.EnumerateMataFileProc委托中,数据参数是实际的GDI对象,在本

在C中定义以下Windows GDI类型时,我需要一些帮助。我在C中有字节[]形式的数据,我需要以某种方式在C中封送或强制转换它,如下所示。我想我需要定义正确的结构?这是一种:

名称 最近的API调用 描述
多段线是点的列表。与多边形不同,多段线总是未填充的,并且可以打开。

您查看了吗?

好的,多段线的图元文件记录。。。您可能希望尝试执行从字节数组到UInt16数组的转换


未经测试

谢谢大家。假设在我的Graphics.EnumerateMataFileProc委托中,数据参数是实际的GDI对象,在本例中是多段线,我是否正确?我刚刚测试了上面的代码,它工作得很好。我可以再问一个吗?如何将WmfPolygon转换为c?获得多边形,谢谢介绍。这个问题有问题如果您有时间,请:
META_POLYLINE
#include <windows.h>
BOOL32 Polyline
(
    HDC32 hdc,
    const POINT32 *pt,
    INT32 count
);
U16 array no Value --------------------------- -------------- 0 no of points 1 each odd until the end x of the point 2 each even until the end y of the point
byte[] buffer;
fixed (byte* b = buffer)
{
   ushort* ptr = (ushort*)b;
   int count = (int)*ptr;
   var points = new Point[count];
   for (int i = 0; i < count; i++)
   {
       int x = (int)*(++ptr);
       int y = (int)*(++ptr);
       points[i] = new Point(x, y);
   }
}