InterviewSolution
| 1. |
How To Load Bitmap In Dialog Background In An Mfc Application? |
|
Answer» In OnInitDialog: ----------------- 1. Create CBitmap from the bitmap. 2. Create a memory DC (CDC) 3. PUT the CBitmap into the memory DC (Use CDC::SelectObject function). In OnPaint: ------------ 4. GET your dialog DC (CDialog::GetDC) 5. Do BitBlt or StretchBlt on dialog DC with memory DC as source DC (this will paint the bitmap on your dialog). 6. RELEASE dialog DC (RELEASEDC function) In OnInitDialog: ----------------- 1. Create CBitmap from the bitmap. 2. Create a memory DC (CDC) 3. Put the CBitmap into the memory DC (Use CDC::SelectObject function). In OnPaint: ------------ 4. Get your dialog DC (CDialog::GetDC) 5. Do BitBlt or StretchBlt on dialog DC with memory DC as source DC (this will paint the bitmap on your dialog). 6. Release dialog DC (ReleaseDC function) |
|