- First create or load a picture in a graphics application, such
as MS Paint or Paint Shop Pro, that can create good pictures. Don't
use the Image Editor of MSVC. For example, here is a picture in
Microsoft Paint (MS Paint is an application that installs with
- Save the picture as a bitmap (with the .bmp extension) and
remember where you save it.
- Start Microsoft Visual Studio or Microsoft Visual C++ and, using MFC AppWizard (exe)
or MFC Application, create a Dialog-Based project named Bitmaps1
- Delete the TODO line on the dialog box
- To add the bitmap picture, in the Resource View, right-click any
folder and click Import...
- In the Import Picture dialog box, change the files of type to All
- Locate the folder where you saved the picture and display it in the
Look In combo box
- Click the name of the picture and click Import
- You should receive a message box. Read it and click OK.
Right-click the name IDB_BITMAP1 and click Properties. Change its ID
- From the Controls toolbox, click the Picture control and draw the
frame of the picture where you want to display the picture on the
dialog box. Here is an example
- In the Properties window, change its ID to IDC_PICTURE
- Change its Type to Bitmap and, in the Image combo box, select
IDB_PICTURE1 and click anywhere on the dialog box:
- As you can see, this was done without a single line of code. You can
test the application now to see the result.