MFC - Image Editor


Advertisements

The Image editor has an extensive set of tools for creating and editing images, as well as features to help you create toolbar bitmaps. In addition to bitmaps, icons, and cursors, you can edit images in GIF or JPEG format using commands on the Image menu and tools on the Image Editor Toolbar.

Let us look into a simple example by creating a new project.

Step 1 − Add a Bitmap from Add Resource dialog box.

Add Resource Bitmap

Step 2 − Select Bitmap and click New. It will open the Image editor.

Select Bitmap Button

Step 3 − Design your bitmap image in Image editor and change its ID to IDB_BITMAP_START as shown above.

Step 4 − Add a button to your dialog box and also add a control Variable m_buttonStart for that button.

Step 5 − Add a bitmap variable to your header file. You will now see the following two variables.

CBitmap m_bitmapStart;
CButton m_buttonStart;

Step 6 − Modify your OnInitDialog() method as shown in the following code.

m_bitmapStart.LoadBitmap(IDB_BITMAP_START);
HBITMAP hBitmap = (HBITMAP)m_bitmapStart.GetSafeHandle();
m_buttonStart.SetBitmap(hBitmap);

Step 7 − When the above code is compiled and executed, you will see the following output.

Bitmap Button
mfc_windows_controls.htm
Advertisements