I am proposing a built-in feature for wxFrame to allow custom title bar painting while maintaining 100% native OS integration. This approach provides a modern look without the typical drawbacks of "borderless" or "client-side decoration" hacks.
Native DWM Integration: Maintains the Native Border, Native Shadow, and full support for Windows 11 Snap Layouts.
No Layout Disruption: Unlike standard CSD approaches, this does not use WM_NCCALCSIZE to remove the caption. It preserves the real caption area, meaning no children layout needs to be changed, and native resizing behavior remains intact.
Modern Customization: Full support for custom colors and shapes for the title text, as well as the Minimize, Maximize, and Close buttons, specifically optimized for both Windows 10 and Windows 11 aesthetics.
Windows 11 Ready: Fully supports rounded corners and native DWM attributes.
As shown in the attached screenshot, the application achieves a seamless, modern Ubuntu theme that looks like a high-end commercial app (like Discord or VS Code), but internally it still functions as a standard native Windows frame.
Screenshot.2026-04-09.034300.png (view on web)
https://github.com/user-attachments/assets/6a76b1d4-67c2-48c7-86e5-1e448d4f1863
Proposed API:
I suggest adding a mechanism to wxFrame that allows users to override the NC (Non-Client) painting providing a clean way to "skin" the title bar without losing the stability of the native window manager.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
How much code would it take to achieve this? I expect that some people would love to use this but I'm also a bit afraid that we're going to end up with a lot of code that will need to be maintained and updated for every new Windows release.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
How much code would it take to achieve this? I expect that some people would love to use this but I'm also a bit afraid that we're going to end up with a lot of code that will need to be maintained and updated for every new Windows release.
Let me answer your questions and dispel your fears.
How much code would it take to achieve this?
short and clean if there is no extended features.
afraid that we're going to end up with a lot of code that will need to be maintained and updated for every new Windows release.
Let's see how my magic will solve this problem.
A - Use 2 documented APIs that have small Breaking changes over the past 15 years Since the Windows Vista operating system (DwmGetWindowAttribute and DwmSetWindowAttribute functions).
1- DWMWA_ALLOW_NCPAINT (one breaking change since windows vista until Windows 11 22000).
2- DWMWA_CAPTION_BUTTON_BOUNDS (my be also has one breaking change since windows vista until Windows 10 1703).
3- DWMWA_CAPTION_COLOR (used becuase of Windows 11 22000 DWMWA_ALLOW_NCPAINT breaking change).
4- DWMWA_BORDER_COLOR (used becuase of Windows 11 22000 DWMWA_ALLOW_NCPAINT breaking change).
5- DWMWA_NCRENDERING_ENABLED(used to check if our Frame Has Dwm Frame)
6- DwmExtendFrameIntoClientArea (used becuase of Windows 11 22000 DWMWA_ALLOW_NCPAINT breaking change).
B- Use NonCient area Windows and Messages(never has Breaking changes).
1- Mouse Input Notifications
WM_NCLBUTTONDOWN
WM_NCLBUTTONUP
WM_NCMOUSELEAVE
WM_NCMOUSEMOVE
2- Painting and Drawing Messages
WM_NCPAINT
WM_NCACTIVATE
WM_NCCALCSIZE(my be used or my be not used)
change steyle Messages
WM_DWMNCRENDERINGCHANGED
WM_STYLECHANGED
now Let's expain How the real magic work.
When initializing the theme.
or our frame received WM_DWMNCRENDERINGCHANGED.
static bool IsDwmEnabled(HWND hwnd) { BOOL isDwmEnabled = FALSE; HRESULT hr = ::DwmGetWindowAttribute(hwnd, DWMWA_NCRENDERING_ENABLED, &isDwmEnabled, sizeof(isDwmEnabled)); return SUCCEEDED(hr) && isDwmEnabled; } if (IsDwmEnabled(hwnd)) { BOOL allow = TRUE; DwmSetWindowAttribute(hwnd, DWMWA_ALLOW_NCPAINT, &allow, sizeof(allow)); }
now let's see How our Frame Will look in this image until Windows 11 22000 there is no breaking changes.
our Frame Make content rendered in the non-client area to be visible on the frame so dwm 7px (left,right,bottom) frame now is visible.
Screenshot.2026-04-11.100202.png (view on web)
To fix this we can use WM_NCCALCSIZE to remve them our keep them.
now let's see How our Frame Will look in this image after Windows 11 22000 and breaking changes.
Screenshot.2026-04-11.100526.png (view on web)
You can look at my old issue for this at dotnet/winforms#6364.
But they didn't know what is borken until now.
As you can see there is another dwm Frame with white or transparent(drak) Dwm Frame is visable at client area
this is the new 1px border color Frame around the Window it will be aslo visable
to fix this You need use the new Attributes for Windows 11 22000 that Breaking DWMWA_ALLOW_NCPAINT and DwmExtendFrameIntoClientArea.
eg.
DWMWA_CAPTION_COLOR
DWMWA_BORDER_COLOR
Now we have to options
if (IsDwmEnabled(hWnd)) { BOOL allow = TRUE; DwmSetWindowAttribute(hWnd, DWMWA_ALLOW_NCPAINT, &allow, sizeof(allow)); COLORREF capColor = RGB(0, 0, 0); DWORD borderColor = DWMWA_COLOR_NONE; HRESULT hr = DwmSetWindowAttribute(hWnd, DWMWA_CAPTION_COLOR, &capColor, sizeof(capColor)); if (SUCCEEDED(hr)) { DwmSetWindowAttribute(hWnd, DWMWA_BORDER_COLOR, &borderColor, sizeof(borderColor)); MARGINS margins = { -1 }; DwmExtendFrameIntoClientArea(hWnd, &margins); } }
##Pure GDI draw over Dwm Frame.
To use GDI draw duirng WM_NCPAINT over Dwm Frame.
we need to implement-double-buffering to correct Alpha Blending eg. (BeginBufferedPaint,BitBlt)
or use old gdi trick to set the alpha channel of a GDI bitmap to 255? GDI bitmap Opaque
wParam of WM_NCPAINT can be intersect Regoin this never broken over the past 15 years Since the Windows Vista operating system but it's not correctly Documented.
see Wm_NCPAINT Documantion.
To avoid use undocumnted explanation of using this Regoin .
1- never check if wParam =1 or not only check if it's real Regoin.
bool hasRegion = (GetObjectType((HGDIOBJ)wParam) == OBJ_REGION);2- WM_NCPAINT provides a system-owned region in wParam.
We create a copy because GetDCEx with DCX_INTERSECTRGN takes ownership
and deletes the provided HRGN handle. Copying prevents us from
prematurely destroying the system's original handle.
3-Modern glyphs for Windows 10/11 (Segoe Fluent Icons / Segoe MDL2 Assets)
Full WinApi draft Example project Url mediafire
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@vadz
if you find it good idea let's discuss details about how to implement it in draft pull request or we need to close this.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()