First download cxiamge. I am using cxiamge_702.
: Http://download.csdn.net/detail/xing_ping_1987/8085129
Compile static library
Create a project. The specific configuration in vs2010 is as follows:
1. Configure-> General-> Use of MFC, and select "use MFC in static library ".
Configure the general character set and select multi-byte character set ".
2. Project -- properties -- configuration properties -- General, select "use MFC in static library" and use "Multi-Byte Character Set ".
3. "C/C ++" -- "General --" attaches the include directory and fills in the above include folder location.
4. "connector" -- "general" -- "additional library directory, fill in the above lib folder location.
End.
Compile the project. Write a piece of code and try it. In the View class, write include <ximage. h> to the ondraw () function:
HDC;
HDC = PDC-> m_hdc;
Cstring filename ("E: \ 11.jpg ");
Cximage cimage;
Cimage. Load (filename, cximage_format_jpg );
Cimage. Draw (HDC, 0, 0 );
Compile and run it. You can see the image and it will be OK.
Cxiamge uses static library vs2010