Is it possible to configure Multicolor Multiline TMemo in Delphi XE2?.
When I am writing codes like :
procedure TForm1.BitBtn1Click(Sender: TObject);
var
FirstVariable, SecondVariable, ThirdVariable :BOOL;
begin
if FirstVariable then
begin
Memo1.Font.Color := clGreen;
Memo1.Lines.Add('FirstVariable = True');
end
else if SecondVariable then
begin
Memo1.Font.Color := clBlue;
Memo1.Lines.Add('SecondVariable = True');
end
else
begin
Memo1.Font.Color := clRed;
Memo1.Lines.Add('ThirdVariable = True');
end;
end;
font color for all the previously existing lines are getting changed according to condition of the variables.
No, it is not possible. But you can use a RICHEDIT control instead, e.g., the TRichEdit
wrapper.
RichEdit1.SelAttributes.Color := clGreen;
RichEdit1.Lines.Add('First line.');
RichEdit1.SelAttributes.Color := clBlue;
RichEdit1.Lines.Add('Second line.');
RichEdit1.SelAttributes.Color := clRed;
RichEdit1.Lines.Add('Third line.');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With