• Advertisement
Sign in to follow this  

Question about painting over dialog box title bars.

This topic is 4012 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement