Home > Software engineering >  VC/MFC background loading images such as images
VC/MFC background loading images such as images

Time:10-11

If inscribe
VC out the framework of general background is white forehead
How can I load images as background
I've struggled with for a long time do not want to
Troublesome everybody greatly myself -- --
O the point code

CodePudding user response:

If the base class to CDialogEx, SetBackgroundImage
Can also add WM_ERASEBKGND message response, and then map

CodePudding user response:

http://blog.csdn.net/xianglifighter/article/details/34840207

CodePudding user response:

There are many ways, the commonly used two kinds of: (1) the picture control controls, and associated images; (2) (recommended) painted directly, also has a lot of related functions, are relatively convenient point of use CImage class, the Load () method of the image resources, BitBlt () method will render to DC images, the knowledge of the MFC, baidu knows a lot, you don't ask, the hope can help you

CodePudding user response:

To load a bitmap and then painted, should be ok!

CodePudding user response:

Bitblt loaded bitmap

CodePudding user response:

Dialog box to add member variables: CImage m_Image;

In the dialog initialization function to Load the bitmap: m_Image. Load (_T (" images \ \ 3. JPG "));

In the final add OnPaint function display code:
 CRect the rect. 
The CDC * pDC=GetDC ();

GetClientRect (& amp; The rect);
PDC - & gt; SetStretchBltMode (COLORONCOLOR);
M_Image. The Draw (pDC - & gt; M_hDC, the rect);

CodePudding user response:

WM_ERASEBKGND + double buffer technique

CodePudding user response:

WM_ERASEBKGND message response in OnEraseBkgnd BitBlt load display images,

CodePudding user response:

the building Lord is too complicated, I suggest use other interface library, you will be super convenient, such as what dazzle colour interface library

CodePudding user response:

I give an example, not to help the original poster, just like to see some sort of being beaten face
Its original flavor adds a WIN32 showpic function, can display JPG, BMP, GIF,
Function, even 10 braces and the file name is 45 lines of code

http://download.csdn.net/download/gz_qmc/9618358

CodePudding user response:

The
references to the tenth floor gz_qmc response:
I give an example, not to help the original poster, just like to see some sort of people being beaten face
Its original flavor adds a WIN32 showpic function, can display JPG, BMP, GIF,
Function, even 10 braces and the file name is 45 lines of code

http://download.csdn.net/download/gz_qmc/9618358

CodePudding user response:

The background image is added in the OnPaint function
  • Related