Delphi XE2中的RichEdit控件在某些样式下不会显示字体颜色
我刚刚注意到,在 Delphi XE2 中的一些新的 VCL 样式中,尝试更改 RichEdit 控件中的文本颜色不起作用。例如,Smokey Quarts Kamri 和 Carbon 只会以黑色显示文本,而在 Cobalt XEMedia 中,字体颜色可以更改。这是我用来更改字体颜色的代码(粗体似乎适用于所有样式)
memo.selStart:= length (text);
memo.selLength:= 0;
memo.SelAttributes.Color:= clRed;
memo.SelAttributes.Style:= [fsBold];
memo.selText := text;
关于如何在使用 Delphi XE2 样式时更改 RichEdit 控件上的字体颜色有什么想法吗?
I just noticed that in some of the new VCL styles in Delphi XE2, trying to change the color of text in a RichEdit control doesn't work. For example Smokey Quarts Kamri and Carbon will only show text in black, while in Cobalt XEMedia the font color can be changed. This is the code I used to change the font color (bold seems to work in all styles)
memo.selStart:= length (text);
memo.selLength:= 0;
memo.SelAttributes.Color:= clRed;
memo.SelAttributes.Style:= [fsBold];
memo.selText := text;
Any ideas on how to change the font color on a RichEdit control while using Delphi XE2 styles?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这似乎是一个 VCL 样式错误,但您可以使用样式挂钩轻松修复此问题。
并像这样使用
It seems a VCL Styles bug, but you can fix this easily using a Style hook.
and use like so
过去的
TStyleManager.Engine.RegisterStyleHook(TRichEdit, TRichEditStyleHookFix);
在您的 *.dpr 文件中
:
Past
TStyleManager.Engine.RegisterStyleHook(TRichEdit, TRichEditStyleHookFix);
in your *.dpr file
eq: