Win32 : set default font and text color for rich edit

爱⌒轻易说出口 提交于 2021-02-08 03:40:06

问题


It should be an easy question but I was unable to find an answer on google: How to set a default font and color to a richedit using plain c++ and win32 ?


回答1:


From MSDN:

You can also use EM_SETCHARFORMAT and EM_GETCHARFORMAT messages to set and retrieve the character formatting of the insertion point, which is the formatting that is applied to any subsequently inserted characters. For example, if an application sets the default character formatting to bold and the user then types a character, that character is bold.

Is that what you're looking for?




回答2:


From MSDN also

Rich Edit 4.1: To set the default font for a script, call EM_SETCHARFORMAT with CHARFORMAT2, specifying values for the yHeight, bCharSet, bPitchAndFamily, szFaceName, and lcid members. Also, to get the default font for a specific code page, call EM_GETCHARFORMAT with CHARFORMAT2, specifying values for the bCharSet and lcid members.



来源:https://stackoverflow.com/questions/11724231/win32-set-default-font-and-text-color-for-rich-edit

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