How to set a font in rich edit 4?

别来无恙 提交于 2021-01-28 19:46:44

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!