随笔-6  评论-0  文章-0  trackbacks-0
在使用Gdiplus的功能之前,要先进行初始化,对应的函数是Gdiplus::GdiplusStartup,在使用完Gdiplus的功能之后,要进行反初始化,对应的函数则是Gdiplus::GdiplusShutdown。
为了简化编程,这里实现了一个简单的Gdiplus初始化类,作为全局对象使用,类似于MFC的theApp对象。代码如下:
#pragma once

#include <GdiPlus.h>

class GdiPlusHelper
{
public:
    GdiPlusHelper()
    {
        Gdiplus::GdiplusStartupInput gdiplusStartupInput;
        Gdiplus::GdiplusStartup(&m_nGdiPlusToken, &gdiplusStartupInput, NULL);
    }
    ~GdiPlusHelper()
    {
        Gdiplus::GdiplusShutdown(m_nGdiPlusToken);
    }
    ULONG_PTR m_nGdiPlusToken;
};

posted on 2015-03-19 15:14 weigtcs 阅读(185) 评论(0)  编辑 收藏 引用

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理