问题
How do I change the font of an edit control in win32 API. I would like to be able to edit the style as well as the color of a font on a edit control.
回答1:
First you should clarify that you're talking about a standard Edit control versus a Rich Edit control - the two are totally different.
You can change the font by sending a WM_SETFONT message to the edit control. Setting the color is a totally different process.
You can set the text color by responding to the WM_CTLCOLOREDIT message in the owner of the edit control.
回答2:
You can send it a WM_SETFONT message. Be warned, though, as the link explains, you may have to re-size the control after changing the font.
回答3:
For a standard edit control, handle the WM_CTLCOLOREDIT
message to set the text and background colours.
来源:https://stackoverflow.com/questions/8994992/how-do-i-change-the-font-of-a-control-in-winapi-c