EDN Admin
Well-known member
In WM_PAINT i have used the following code to display a bitmap image in a MFC dialog using C++. I have loaded the bitmap in OnInitDialog().
hdcMem = CreateCompatibleDC(dc);
hbmOld = (HBITMAP)SelectObject(hdcMem, g_b);
GetObject(g_b, sizeof(bm), &bm);
BitBlt(dc, 0, 0, abs(bm.bmWidth), abs(bm.bmHeight), hdcMem, 0, 0, SRCCOPY);
SelectObject(hdcMem, hbmOld);
Sleep(500);
hbmOld = (HBITMAP)SelectObject(hdcMem, g_h);
GetObject(g_h, sizeof(bm), &bm);
BitBlt(dc, 0, 0, abs(bm.bmWidth), abs(bm.bmHeight), hdcMem, 0, 0, SRCCOPY);
SelectObject(hdcMem, hbmOld);
Sleep(500);
DeleteDC(hdcMem);
Kindly let me know how to display the bitmap image in a MFC Dialog box using C++.
Thanks
View the full article
hdcMem = CreateCompatibleDC(dc);
hbmOld = (HBITMAP)SelectObject(hdcMem, g_b);
GetObject(g_b, sizeof(bm), &bm);
BitBlt(dc, 0, 0, abs(bm.bmWidth), abs(bm.bmHeight), hdcMem, 0, 0, SRCCOPY);
SelectObject(hdcMem, hbmOld);
Sleep(500);
hbmOld = (HBITMAP)SelectObject(hdcMem, g_h);
GetObject(g_h, sizeof(bm), &bm);
BitBlt(dc, 0, 0, abs(bm.bmWidth), abs(bm.bmHeight), hdcMem, 0, 0, SRCCOPY);
SelectObject(hdcMem, hbmOld);
Sleep(500);
DeleteDC(hdcMem);
Kindly let me know how to display the bitmap image in a MFC Dialog box using C++.
Thanks
View the full article