How to change the font of a control in WinApi C ++?

How to change font of edit control in win32 API. I would like to be able to edit the style as well as the font color in the edit control.

+4
source share
3 answers

First you must clarify what you are talking about the standard Edit and Rich Edit controls - these are two completely different.

You can change the font by sending the WM_SETFONT message to the edit control. Setting color is a completely different process.

You can set the color of the text by replying to the WM_CTLCOLOREDIT message from the owner of the edit control.

+6
source

You can send the message WM_SETFONT . Be careful, however, as the link explains, you may need to resize the control after changing the font.

+4
source

For the standard WM_CTLCOLOREDIT message editing WM_CTLCOLOREDIT set the text and background color.

+1
source

Source: https://habr.com/ru/post/1392798/


All Articles