1

我正在尝试将 InfoBefore 文本文件的文本存储到一个变量中,然后使用自定义字体颜色和背景色将其加载到 RTFEditor 中。

当我尝试从变量加载文本时,它显示“只写属性”

我需要一个明确的例子来说明如何一起做这两件事(将文本存储在 var 中,使用自定义颜色和背景色加载 RTF 中的文本)而不会使事情过于复杂,因为我不知道 Pascal。

这是代码:

const
 FontColor: AnsiString = 'cf0'; 
 BackColor: AnsiString = 'cf1'

 var
  OldText: AnsiString; 

procedure InitializeWizard();
begin

// I try to store the text in a variable
Oldtext := WizardForm.InfoBeforeMemo.RTFText; 

// I try to load from the variable, with a new font color for ALL the text, and a new BackColor.
WizardForm.InfoBeforeMemo.RTFText := Oldtext + FontColor

end;
4

1 回答 1

3

与其在事后尝试修改它,只需在写字板中加载您的 .txt 文件,进行所需的格式更改,然后将其保存为 .rtf 格式。然后,您可以直接将此文件用作您的文件InfoBeforeFile,而无需使用任何代码。

编辑:如果你想改变整个备忘录的背景颜色,那么你仍然需要一行代码。例如:

[Code]
procedure InitializeWizard();
begin
    WizardForm.InfoBeforeMemo.Color := clBlack;
end;
于 2013-04-21T21:37:47.453 回答