Question about painting over dialog box title bars.

Started by
0 comments, last by Johnny Sunshine 17 years, 1 month ago
Hello guys, I have a question about painting over dialog box title bars. I want to use my own image for the title bar and border of a dialog box but am having difficulties. I am new to GDI Win32 so sorry if this sounds newbish... but anyways...what I have so far is: case WM_ERASEBKGND: { return 1; } case WM_NCPAINT: { HDC hdc = GetDCEx(hwndDlg, (HRGN)wParam, DCX_WINDOW|DCX_INTERSECTRGN); HDC hdcMem = CreateCompatibleDC(hdc); SelectObject(hdcMem, hbmBorder); BITMAP bm; GetObject(hbmBorder, sizeof(bm), &bm); BitBlt(hdc, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY); ReleaseDC(hwndDlg, hdcMem); ReleaseDC(hwndDlg, hdc); return 1; } All this does is render the title bar/border using whatever is behind it a the time it is rendered. If I return 0 from WM_NCPAINT it just draws the default background. I tried using GetWindowDC(...) but that still yields the same result. Thank you for your help. Jeremy (grill8)
Advertisement
I once did the same thing, and got it working woth DCX_WINDOW | DCX_CACHE.

However, it had some problems, namely, the validation/invalidation of the window (for example, when moving the window outside the screen and back again).

The best idea would be to create a window with absolutely no borders, an to write a moving routine (using WM_LBUTTONDOWN, WM_MOUSEMOVE and WM_LBUTTONUP). This was the thing I used in several applications wich used irregular borders or fancy skins.

This topic is closed to new replies.

Advertisement