MFC中使用GDI+

来源:互联网 发布:ketchup mac 编辑:程序博客网 时间:2024/05/18 09:55

1.执行下面批处理代码:

echo #ifndef _GDIPLUSBASE_H>GdiPlusBase.h
echo #define _GDIPLUSBASE_H>>GdiPlusBase.h
echo class GdiplusBase{};>>GdiPlusBase.h
echo #endif>>GdiPlusBase.h
echo #pragma comment(lib,"gdiplus.lib")>>stdafx.h
echo #ifndef ULONG_PTR>>stdafx.h
echo #define ULONG_PTR unsigned long *>>stdafx.h
echo #endif>>stdafx.h
echo #include "GdiPlusBase.h" >> stdafx.h
echo #include ^<gdiplus.h^> >> stdafx.h
echo using namespace Gdiplus; >> stdafx.h
del %0

2.执行下面操作:

● 在…app类的头文件中加入成员变量:(对话框工程,可在……dlg类中添加) 
protected:
ULONG_PTR m_gdiplusToken;

● 在…app的成员函数initInstance中加入(放在函数内CWinApp::InitInstance()语句之前)(对话框工程可在OnInitDialog函数中添加)
GdiplusStartupInput gdiplusStartupInput;
GdiplusStartup(&m_gdiplusToken,&gdiplusStartupInput,NULL);

● 在…app的成员函数ExitInstance(重载函数)中加入:(对话框工程可在OnClose函数中添加)
GdiplusShutdown(m_gdiplusToken);

0 0
原创粉丝点击