我知道我可以从 GDI 的HENHMETAFILE
usingGetEnhMetaFileBits
函数中获取原始元文件字节。但是如何从
Gdiplus::Metafile
GDI+ 的对象中获取原始字节?
问问题
223 次
1 回答
1
public static void Save(Metafile matafile, Stream stream)
{
using (stream)
{
using (Bitmap bit = new Bitmap(1, 1))
{
using (Graphics gs = Graphics.FromImage(bit))
{
Rectangle rt = new Rectangle(0, 0, matafile.Width, matafile.Height);
using (Metafile mf = new Metafile(stream, gs.GetHdc(), rt, MetafileFrameUnit.Pixel, EmfType.EmfOnly))
{
using (Graphics g = Graphics.FromImage(mf))
{
g.DrawImage(matafile, rt);
}
}
}
}
}
}
于 2021-01-08T08:44:21.423 回答