PNG作为背景图像 [英] PNG as background image

查看:104
本文介绍了PNG作为背景图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我想知道有什么方法可以将.png文件作为SDI或基于对话框的应用程序的背景。



regds

Hi,

I want to know is there any way by which we can loag .png file as a background of SDI or dialog based application.

regds

推荐答案

Windows仅支持用于在曲面上绘制的位图图像。因此,必须首先将PNG图像转换为位图。这可以通过MFC CImage 类完成:

Windows supports only bitmap images for drawing on the surface. So the PNG image must be converted to a bitmap first. This can be done with the MFC CImage class:
CImage image;
image.Load(_T("image.png"));
CBitmap bitmap;
bitmap.Attach(image.Detach());



上面加载的位图图像现在可以用作任何 CWnd的背景窗口覆盖 OnEraseBkgnd()方法并复制位图。



见此CP文章:对话框的位图背景 [ ^ ]。


The above loaded bitmap image can be now used as background for any CWnd window by overwriting the OnEraseBkgnd() method and copying the bitmap.

See also this CP article: Bitmap Backgrounds For Dialog Boxes[^].


这篇关于PNG作为背景图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆