I can see that there are so many processing methods for PNG images, but I cannot figure it out. How do they use GDI + PNG for processing?
Isn't it the most efficient and best method? Is it cximage + PNG Image Processing?
To use the cximage class, you also need to download a cximage demo. These files are used in it!
Find these files and copy them to your project for configuration. Then you can use the cximage class.
Step 1: Open the project and click projects -- settings.
After the configuration is successful, check whether you have these items.
Cximage. Lib libdcr. Lib jpeg. Lib Jasper. Lib MNG. Lib PNG. Lib Tiff. Lib zlib. Lib
Are there any of these items. Check it out.
The header file is imported.
You press F5 to debug
Check if there is any problem. This is not the case yet. You have to perform a code test. Is there a problem,
You can add the header file in your cxxxxxxdlg to check whether it is recognized.
# Include "ximage. H"
Public:
Cximage * m_bgcximage;
Let's see if it succeeds. If it succeeds, we can do something. Haha.
Let's use a jpg image to test the effect. Add a background to the dialog box. Okay. First, use your Ps or other tools to save your image as JPG.
You have to add a function here. The first step is to press Ctrl + W. Click class info, click message filter, and select windows click OK.
Press Ctrl + W to add the onerasebkgnd function.
Okay, the specific code. I will post it to you. Check whether it is successful.
Bool ccximagedlg: onerasebkgnd (CDC * PDC)
{
// Todo: add your message handler code here and/or call default
// Return cdialog: onerasebkgnd (PDC );
Rect;
Getclientrect (& rect );
M_bgcximage-> tile (PDC-> getsafehdc (), & rect );
Return true;
}
Write it in oninitdialog (), and paste the jpg image.
M_bgcximage = new cximage ();
Hrsrc temp = findresource (null, "idr_jpg1", "jpg ");
If (! M_bgcximage-> loadresource (temp, cximage_format_jpg )){
Delete m_bgcximage;
M_bgcximage = NULL;
}
The effect after running is as follows.
By the way, when importing a jpg image, you must add quotation marks without prompting you to find the resource.
Thank you. Today, the network is not very good. How can I add a + PNG Image to cbutton tomorrow.