Link to home
Start Free TrialLog in
Avatar of lobrjos
lobrjos

asked on

Fonts and colors in a CEdit

How do you change the font, font color, and background color
of a CEdit control that has been placed on a view through code?

I have tried the function CWnd::SetFont() to no avail. When I do this nothing appears in the edit box when I type.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of mikeblas
mikeblas

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lobrjos
lobrjos

ASKER

One thing to add about the answer to this question is that the WM_CTLCOLOR message to be handled by the control is a "reflection" message not the standard windows message.

Simply put, when you do using the class wizard in MFC you must use the WM_CTLCOLOR reflection message to add the handler (this is prefixed in the messages list of the class wizard dialog box with an = (i.e. =WM_CTLCOLOR not the WM_CTLCOLOR.

It took me a little while to figure this out.

Thanks for your help,

Joe