welen

I、png.h

#include <GdiPlus.h>

using namespace Gdiplus;

#pragma comment(lib,"GdiPlus.lib")

 

//采用GDI+绘制png格式图片

 

class PNG

{

private:

ULONG_PTR token;

public:

PNG();

void draw(WCHAR* path,HDC &hdc,int x,int y,int cx,int cy);

~PNG();

};

 

II、png.cpp

#include "stdafx.h"

#include "png.h"

//PNG

 

PNG::PNG()

{

GdiplusStartupInput in;

GdiplusStartup(&token,&in,NULL);

}

 

PNG::~PNG()

{

GdiplusShutdown(token);

}

 

void PNG::draw(WCHAR* path,HDC &hdc,int x,int y,int cx,int cy)

{

Graphics g(hdc);

Image im(path,false);

g.DrawImage(&im,x,y,cx,cy);

}

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2021-06-04
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-15
  • 2022-12-23
  • 2022-12-23
  • 2021-06-25
  • 2021-12-25
相关资源
相似解决方案