I am using Delphi XE3. I need to set some parts of a long statement to bold and red. Since TLabel does not support such a feature, while merge several TLabels is rather inconvenient, and TJvHTLabel does not support bold, I decide to implement that via a TRichEdit control, by setting:
- BorderStyle to bsNone.
- ParentColor to true.
- ReadOnly to true.
Then use the following code to set 2 characters to bold:
reMsg.SelStart := 2;
reMsg.SelLength := 2;
reMsg.SelAttributes.Style := [fsBold];
reMsg.SelStart := 0;
reMsg.SelLength := 0;
But I find the font of the rich edit control will changes to a strange one. Below is a comparison of the tlabel control and trichedit control:
You can see in the second caption, the font is changed.
I try many methods, such as set the font of the richedit control manually:
reMsg.Font.Name := labMsg.Font.Name;
reMsg.Font.Charset := labMsg.Font.Charset;
But still cannot solve the problem.
Why?