Click to See Complete Forum and Search --> : change font in a Button


bronzefury
September 16th, 2005, 04:55 PM
Hello,

Just starting to learn Win32 API and I'm working with Button controls, so I have a few questions...

1) How do I change the font type that appears on a Button? Currently, what shows up is (I think) a system font. Looks really ... not so nice.

2) Also, wanted to see if I could get some tips or advice from you professionals out there. What button type is typically used for applications and how are they designed? Say, for example, buttons on a web browser,.. how are the button icons drawn? how to make it change when a mouse pointer is over it (is there a way to do it that is easier that handling WM_MOUSEOVER messages?).

Thanks,

kirants
September 16th, 2005, 09:51 PM
Send WM_SETFONT message to the button window passing the new font handle.
Destroy the font handle when your button is being destroyed using DeleteObject
See this:
How to change font of a control (http://www.codeguru.com/forum/showthread.php?t=356532)

To create a font, use CreateFont, CreateFontIndirect family of Win32 APIs.

To get cool look and feel, you have to implement owner drawn buttons.
Please look at articles here. Most would be using MFC , but you can translate to Win32 equivalents.
Button controls (http://www.codeguru.com/Cpp/controls/buttonctrl/)

bronzefury
September 17th, 2005, 10:25 PM
Thanks for the info..

After reading some more internet articles, my approach will be to create custom Child Windows.