1. Insert a bitmap resource image. If the Resource Name Is idc_bitmap1
2. In cxxxdialog: onpaint (), implement:
Void cmydialogdlg: onpaint () {If (isiconic () {cpaintdc DC (this); // The device context sendmessage (wm_iconerasebkgnd, reinterpret_cast <wparam> (DC. getsafehdc (), 0); // center the icon in the rectangle of the workspace int cxicon = getsystemmetrics (sm_cxicon); int cyicon = getsystemmetrics (sm_cyicon); crect rect; getclientrect (& rect); int x = (rect. width ()-cxicon + 1)/2; int y = (rect. height ()-cyicon + 1)/2; // draw the icon DC. drawicon (x, y, M_hicon);} else {// Add to the window? Background // cpaintdc DC (this); crect RC; getclientrect (& rc); CDC dcmem; dcmem. createcompatibledc (& DC); cbitmap BMP background; BMP background. loadbitmap (idb_bitmap1); Bitmap bitmap; BMP background. getbitmap (& Bitmap); cbitmap * pbmppri = dcmem. selectObject (& BMP background); DC. stretchblt (0, 0, RC. width (), RC. height (), & dcmem, 0, bitmap. bmwidth, bitmap. bmheight, srccopy );}}