Hi, I have the above code right after i created a certain window. However, the window was not painted with the bitmap brush i created. Can someone explan why? I thought the new brush will takes effect for the rest of the program life if I use the style CS_OWNDC.Code:HDC hDC; HBITMAP hbitmap; // create bitmap brush hbitmap = LoadBitmap(hinst,MAKEINTRESOURCE(IDB_BACKGROUND)); hbrush = CreatePatternBrush(hbitmap); DeleteBitmap(hbitmap); hDC = GetDC(hwnd); SelectBrush(hDC,hbrush); ReleaseDC(hwnd,hDC); SelectBrush(hDC,GetStockBrush(BLACK_BRUSH));
If I set the hbrBackground field to the bitmap brush during the window class registration, the window is painted properly. I find this very strange.