Sign in to follow this  
grill8

Question about painting over dialog box title bars.

Recommended Posts

grill8    148
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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this