我开发了一个源自richedit组件的自定义组件。
我使用Peter Below创建的PBExEdit中的示例擦除并重新绘制背景。这是成功的,在禁用时为richedit背景提供不同的颜色。但是,richedit中的文本不会重新绘制。我试图使用以下几行没有成功。该组件甚至无法在运行时呈现。
procedure WMPaint...
var Format: TCharFormat2;
begin
//call to erase and paint bg using WMEraseBkGnd...
//Here are the lines that are not working.
try
FillChar(Format, SizeOf(Format), 0);
Format.cbSize := SizeOf(Format);
Format.dwMask := CFM_COLOR;
Format.crTextColor := ColorToRGB(Font.Color);
Perform(EM_SETCHARFORMAT, SCF_ALL, LongInt(@Format));
end;
end;
我也尝试过EM_SETBKGNDCOLOR,但是没有用。
我认为EM_SETCHARFORMAT需要更多...但我不知所措。
任何帮助都将不胜感激。
由于
百里