阅读:1805回复:0
请教大家一个问题,要在我的子窗口控件中贴一张图片,为什么没贴上?
请教大家一个问题,要在我的子窗口控件中贴一张图片,为什么没贴上?下面是代码
case WM_PAINT: hdc = BeginPaint (p->WndMyButtons0, &Paint) ; hBitmap = LoadBitmap(p->Win.Module,TEXT( "sun.bmp")); GetObject (hBitmap, sizeof (BITMAP), &bitmap) ; cxBitmap = bitmap.bmWidth ; cyBitmap = bitmap.bmHeight ; hMemDC = CreateCompatibleDC(hdc); hOldBitmap = (HBITMAP)SelectObject(hMemDC, hBitmap); BitBlt (hdc, 0, 0, cxBitmap, cyBitmap, hMemDC, 0, 0, SRCCOPY) ; SelectObject(hMemDC,hOldBitmap); DeleteDC (hdc) ; DeleteDC (hMemDC) ; EndPaint (p->WndMyButtons0, &Paint) ; return 0; case WM_DESTROY: DeleteObject (hBitmap) ; DeleteObject (hOldBitmap) ; PostQuitMessage (0) ; return 0 ; |
|