问题
I want to change the font of the richedit control in my win32 program to Consolas. When i try to do the following:
CHARFORMAT2 cformat;
cformat.dwMask = CFM_FACE;
cformat.cbSize = sizeof(cformat);
cformat.szFaceName = "Consolas";
On the last line it says that
Expression must be modifiable value
What is the problem here?
Regards,
Devjeet
回答1:
From the documentation, you can see that szFaceName
is an array. You cannot assign to an array that way. (That's what the compiler is trying to tell you. You're trying to assign "Consolas" to something that cannot be modified in that way.) You need to use a string copy function.
来源:https://stackoverflow.com/questions/8024550/how-to-set-a-font-in-rich-edit-4