Hi Xun Zhou,
感谢在MSDN论坛发帖。
>>但由于 GDI 的绘图命令比较单一,不能满足要求,所以就考虑使用 GDI+ ,这时候问题出现了,所有 GDI+ 命令都不起作用!!!
在我的理解中,CDC对象并不能直接调用GDI+资源。如果想在你的工程中使用GDI+,需要进行以下几步操作。使用GDI+对象绘制图形。
1.添加这些到stdafx.h
#include <gdiplus.h>
using namespace Gdiplus;
#pragma comment(lib, "gdiplus.lib")
2.初始化GDI+资源,将这些成员添加到CWinApp继承的类中。
GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
3.在InitInstance()中,添加以下代码。
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
4.使用结束后,调用下面的函数。
GdiplusShutdown(gdiplusToken);
详情参考以下文档。
http://www.codeproject.com/Articles/2529/GDI-in-ActiveX-Controls-Using-MFC
>>基于以上对比,我的问题是:如何能让我自己开发的这个软件生成的图片以 EMF 的格式嵌入在 MS-WORD 中?
GDI+提供了Metafile类,用来记录和显示metafile。在这个类中,你可以使用Image::Save Method
(Stream^, ImageFormat^)将图形存储为EMF格式的文件。
希望对你有所帮助。
Best Regards,
Sera Yu
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.