Although this is a garbage problem in the master, it is very important for our rookie. Because the master is very no dessert.
I just learned that in order to save the rookie as I have, I wrote such an article.
The BMP is displayed in the VC is not as simple as VB, with a loadPicture, what format is OK, and there is some additional work in VC.
We use SDI to demonstrate.
Newly built an SDI project, all is the default. Open the resource editor, right key, IMPORT Select image import. Use the default ID
Don't try to edit him, because his color exceeds 256. Add the following code in the onDraw function:
CDC MEMDC; // Memory device scene
CBITMAP CB; // bit map class object
CRECT RECT;
GetWindowRect (& Re);
Cb.LoadBitmap (idb_bitmap1); // Load resources
MEMDC.CREATECOMPALDC (PDC); // Create a memory device context
CBITMAP * OLDBITMAP = NULL;
OldbitMap = MEMDC.SELECTOBJECT (& CB); // Select bitmap to the current device scene
PDC-> Bitblt (0, 0, Rect.width (), Rect.Height (), & MEMDC, 0, 0, SRCCOPY; // Copy the image of the memory scene to the screen
MEMDC.SELECTOBJECT (OLDBITMAP);
This is done, in fact, it is not difficult to understand, the same principle is the same as the general GDI.
Plus a comment, the vast rookie should be able to understand.