且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Visual studio C ++资源编辑器中导入png文件

更新时间:2022-06-09 05:22:25

使用VS 2008,您可以导入png,他们将被识别为图像,将能够看到它,但是你不能在资源编辑器中修改。

With VS 2008 you can import pngs and they will be recognized as an image, ie you will able to "see" it, but you will not be able to modify with within the resource editor.

但无论如何,问题是它们不会被视为位图,因此您无法将其嵌入到对话框中。但是你可以使用通常的FindResource / LockResource访问它。

But anyway the problem is that they will no be treated as bitmaps, so you can't embedded it inside a dialog. But you can access it with the usual FindResource/LockResource.

同样MFC依赖于GDI,它不支持本地的PNG(至少在XP,尝试Vista或Win7),你将需要将它们转换为BMP无论如何。这里Gdi +可以是有帮助的。

Also as MFC relies on GDI and it doesn't support natively PNG (at least on XP, I didn't try on Vista or Win7) you will need to convert them to BMP anyway. Here Gdi+ can be helpful.

此外,我没有检查VS 2010,也许值得一试,如果它有一个更好的C ++资源编辑器。

Also I didn't check on VS 2010, perhaps worth a try if it have a better C++ resource editor.