Is your application configured to use visual styles? See here for how to enable them.
how to achieve button style in winapi
In The Windows Api(or anytime when using MinGW-w64), when creating a button they have a classic style, i want to achieve a style that dynamically varies between windows versions, on windows 11 it has grey border, white background, rounded, and blue masked when hovered over, on windows 10/8.x it is like windows 11, but gre background and sharp corners and black border, on windows 7/vista it is like windows 11 one, but with visual effects aappplied, someone pleasetell me how to achieve this style of button, i see it everywhere in windows, one common answer is BS_OWNERDRAW and WM_DRAWITEM, but i dont think so, like i see it everywhere in windows, there must be a way without custom drawing
2 answers
Sort by: Most helpful
-
-
Tong Xu - MSFT 2,471 Reputation points Microsoft Vendor
2024-01-30T03:05:59.1766667+00:00 Indeed enabling visual styles makes difference.
Just add the code on the top of the header, it will change something even through using custom controls or not.
#pragma comment(linker,"\"/manifestdependency:type='win32' \
name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \
processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
See the effect:
(before):
(after):