Win32 下使用 GDI+ 遇到的问题.
许多人提出过, 在非MFC模式下,编译GDI+程序,会出现多达130个错误, 多数类似: 不支持默认类型表示.....云云.
解决方法也很快提出来了,在GDI+头 #include<gdiplus.h> 之前加上: <afxwin.h> 之类的mfc的头文件.
算然可以一定程度解决问题(DLL 程序下还需要注释掉#define WIN32_LEAN_AND_MEAN ), 但是一个纯Win32程序按上mfc头文件,好像羊头上安了牛角,太不爽了.
实际上只要简单的加上:
#include <windows.h>
#include <comdef.h >
#include <gdiplus.h>
#pragma comment(lib,"gdiplus.lib")
using namespace Gdiplus;
#include <gdiplus.h>
#pragma comment(lib,"gdiplus.lib")
using namespace Gdiplus;