VC.NET非托管程序如何显示JPEG等格式的图片文件?

1. 直接针对 GDI+ 进行编程,参考 FAQ:
如何在 VC.NET 中利用 GDI+ 进行开发?

2. 在 VC.NET 的新 ATL 类库中,增加了 CImage 类。
CImage provides enhanced bitmap support, including the ability to load and save images in JPEG, GIF, BMP, and Portable Network Graphics (PNG) formats.

例子代码:
#include "altimage.h"

CImage image;
image.Load("test.jpg");
image.Draw(hDestDC,, 0, 0); //hDestDC 为绘图设备上下文句柄

参阅:MSDN ATL Library Reference CImage Class

注意:原贴错误太多,建议不要阅读。(VC.NET版主)

Published At
Categories with Web编程
Tagged with
comments powered by Disqus