It has come to my attention that when I program in Win32 and create buttons, they look like the ones that run on Windows XP. How do you make them (the buttons) look like Windows 7 or Vista at the least? Also, if you run the calculator that comes with your computer, you'll notice that the buttons turn gold when you hover over them, here is an image:
Thanks for the reply, I am using Microsoft VC++ 2008 and 2010.
I did solve the problem with making the buttons look like they are Windows Vista/7. However, I still could not seem to figure out how to change their colors and sizes.
For those of you how are wondering, just add this line to your compiler and it will make the buttons look like they are Windows Vista/7.
(To really customize the look of a button, e.g. give it a custom shape, you need to use owner draw: see MSDN entries for WM_DRAWITEM and DRAWITEMSTRUCT)
I am a bit unsure of the interaction of themes and WM_CTLCOLORBTN.
Andy
P.S. if you're using message relection, adjust approach accordingly
Sorry, it's been a while since I've tried to do this to a push button... I usually colour other controls. It turns out that the WM_CTLCOLORBTN mechanism doesn't work for push buttons.
So it looks like the WM_DRAWITEM approach is the only one available :-(
Andy
From MSDN entry for WM_CTLCOLORBTN Notification
By default, the DefWindowProc function selects the default system colors for the button. Buttons with the BS_PUSHBUTTON, BS_DEFPUSHBUTTON, or BS_PUSHLIKE styles do not use the returned brush. Buttons with these styles are always drawn with the default system colors. Drawing push buttons requires several different brushes-face, highlight, and shadow-but the WM_CTLCOLORBTN message allows only one brush to be returned. To provide a custom appearance for push buttons, use an owner-drawn button.
When a WM_DRAWITEM message arrives it provides you with all the info you need to draw the button (like whether is pushed, etc.), plus the device context to use.
There are functions which can do some of the fork for you: FillRect, FrameRect. And if you are happy enough with standard color edges, DrawEdge (I've never tried to change the color of the edges.)
This project might help you understand the process.