在Delphi XE2中是否可以配置多彩多行TMemo?
当我编写以下代码时:
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;
根据变量条件,所有先前存在的行的字体颜色都会发生改变。
= true
。 - Andreas Rejbrand