VC windows编程如何让背景图片随窗口变化而随机变化大小,不会出现空白
我是在caseWM_PAINT:{PAINTSTRUCTps;HDChdc;HBITMAPhbmp;BITMAPbmp;HDChdcMem;hdc=BeginPaint(...
我是在case WM_PAINT:{
PAINTSTRUCT ps;
HDC hdc;
HBITMAP hbmp;
BITMAP bmp;
HDC hdcMem;
hdc = BeginPaint(hwnd, &ps);
hdcMem = CreateCompatibleDC(hdc);
hbmp = (HBITMAP)LoadImage(NULL, "sea1.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE|LR_CREATEDIBSECTION);
GetObject(hbmp, sizeof(BITMAP), &bmp);
SelectObject(hdcMem, hbmp);
BitBlt(hdc, 0, 0, bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, SRCCOPY);
DeleteDC(hdcMem);DeleteObject(hbmp);
EndPaint (hwnd, &ps) ;
break;
}
这样加入的背景,但是我这个程序改变窗口大小时闪烁很严重,请问怎么避免闪烁 展开
PAINTSTRUCT ps;
HDC hdc;
HBITMAP hbmp;
BITMAP bmp;
HDC hdcMem;
hdc = BeginPaint(hwnd, &ps);
hdcMem = CreateCompatibleDC(hdc);
hbmp = (HBITMAP)LoadImage(NULL, "sea1.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE|LR_CREATEDIBSECTION);
GetObject(hbmp, sizeof(BITMAP), &bmp);
SelectObject(hdcMem, hbmp);
BitBlt(hdc, 0, 0, bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, SRCCOPY);
DeleteDC(hdcMem);DeleteObject(hbmp);
EndPaint (hwnd, &ps) ;
break;
}
这样加入的背景,但是我这个程序改变窗口大小时闪烁很严重,请问怎么避免闪烁 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询