1.包含头文件
(对于VC++6.0,需要自己下载GDI+的SDK,并定义ULONG_PTR)
#ifndef ULONG_PTR
#define ULONG_PTR unsigned long*
#endif

(对于VC++6.0,需要自己下载GDI+的SDK,并定义ULONG_PTR)


#include <gdiplus.h>
using namespace Gdiplus;
#pragma comment(lib,"gdiplus.lib")

2.定义表示Windows版本的宏
#define WINVER 0x0500
#define _WIN32_WINNT 0x0500
#define _WIN32_WINDOWS 0x0510
#define _WIN32_IE 0x0500

3.在应用程序入口初始化GDI+
 GdiplusStartupInput gdiplusStartupInput;
 ULONG_PTR           gdiplusToken;
 GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);

4.在应用程序出口关闭GDI+环境
 GdiplusShutdown(gdiplusToken);

5. 注意事项
GDI+中的字符串要求WCHAR*,可以使用如下宏来转换:
USES_CONVERSION;
LPWSTR x = A2W(lpsz)

 


本文链接地址: GDI+的使用
https://blog.qingfengju.com/index.asp?id=72

上一篇: 为什么你应该(从现在开始就)写博客
下一篇: GDI+中双缓冲的基本写法

分类:Win32/C++ 查看次数:6049 发布时间:2009/6/9 22:23:53