HBITMAP hbmp[54];
HMODULE hModule = GetModuleHandle(NULL);
static void drawTest(DWORD index)
{
BITMAP bt;
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hDlgMain, &ps);
HDC ccdc = CreateCompatibleDC(hdc);
GetObject(hbmp[index], sizeof(bt), &bt);
SelectObject(ccdc, hbmp[index]);
BitBlt(hdc, 70, 70, bt.bmWidth, bt.bmHeight, ccdc, 0, 0, SRCCOPY);
DeleteDC(ccdc);
EndPaint(hDlgMain, &ps);
puts("画图完毕");
}
void test1CppMain()
{
for (DWORD i = 0; i < 54; i++)
{
hbmp[i] = LoadBitmap(hModule, MAKEINTRESOURCE(3000 + i)); //#define IDC_BITMAP0 3000
}
drawTest(1); //第一次画出来了
drawTest(0); //第二次画不出来
return;
}
在dialog中画的
HMODULE hModule = GetModuleHandle(NULL);
static void drawTest(DWORD index)
{
BITMAP bt;
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hDlgMain, &ps);
HDC ccdc = CreateCompatibleDC(hdc);
GetObject(hbmp[index], sizeof(bt), &bt);
SelectObject(ccdc, hbmp[index]);
BitBlt(hdc, 70, 70, bt.bmWidth, bt.bmHeight, ccdc, 0, 0, SRCCOPY);
DeleteDC(ccdc);
EndPaint(hDlgMain, &ps);
puts("画图完毕");
}
void test1CppMain()
{
for (DWORD i = 0; i < 54; i++)
{
hbmp[i] = LoadBitmap(hModule, MAKEINTRESOURCE(3000 + i)); //#define IDC_BITMAP0 3000
}
drawTest(1); //第一次画出来了
drawTest(0); //第二次画不出来
return;
}
在dialog中画的