//这是在ShowWindow之前把图片加载好,并画到内存DC中。
TCHAR szPath[100];
wsprintf(szPath, _T("%s%s"), g_szImagePath, _T("bkImage_bk.jpg"));
g_stIcon[0].bitmapUp = SHLoadImageFile(szPath);
g_stIcon[0].position.left = 0;
g_stIcon[0].position.top = 0;
g_stIcon[0].position.right = SCREENWIDTH;
g_stIcon[0].position.bottom = SCREENHIGHT;
wsprintf(szPath, _T("%s%s"), g_szImagePath, _T("button_up.png"));
g_stIcon[1].bitmapUp = SHLoadImageFile(szPath);
wsprintf(szPath, _T("%s%s"), g_szImagePath, _T("button_down.png"));
g_stIcon[1].bitmapDown = SHLoadImageFile(szPath);
g_stIcon[1].position.left = 0;
g_stIcon[1].position.top = 0;
g_stIcon[1].position.right = 60;
g_stIcon[1].position.bottom = 74;
HDC hdc = GetDC(hwnd);
g_hMerDC = CreateCompatibleDC(hdc);
HBITMAP Canvas = CreateCompatibleBitmap(g_hMerDC, 720, 400);
SelectObject(g_hMerDC, Canvas);
// SetBkColor(g_hMerDC, RGB(0, 0, 0));
// SetBkMode(g_hMerDC, TRANSPARENT);
HDC hTempDC = CreateCompatibleDC(hdc);
SelectObject(hTempDC, g_stIcon[1].bitmapUp);
BitBlt(g_hMerDC, g_stIcon[1].position.left, g_stIcon[1].position.top, g_stIcon[1].position.right, g_stIcon[1].position.bottom,
hTempDC, 0, 0, SRCCOPY);
// SelectObject(g_hMerDC, g_stIcon[IMG_CALL].bitmapUp);
ReleaseDC(hwnd, hdc);
return TRUE;
//下面是在wm_paint的时候
//把背景显示到屏幕上
HDC hTempDC = CreateCompatibleDC(hdc);
SelectObject(hTempDC, g_stIcon[0].bitmapUp);
BitBlt(hdc, 0, 0, SCREENWIDTH, SCREENHIGHT, hTempDC, 0, 0, SRCCOPY);
g_once = FALSE;
DeleteDC(hTempDC);
// SetBkColor(g_hMerDC, RGB(0, 0, 0));
// SetBkMode(g_hMerDC, TRANSPARENT);
//内存DC的拷到显示DC
BitBlt(hdc, 0, 0, SCREENWIDTH, SCREENHIGHT, g_hMerDC, (g_dwCurPage - 1) * 240, 0, SRCCOPY);
复制代码
就这些代码