InnoSetup,如何将自定义文本加载到RTFText

时间:2013-04-20 18:44:06

标签: inno-setup pascal rtf pascalscript

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

当我尝试从变量加载文本时,它会显示“Write-only property”

我需要一个明确的示例,说明如何将这两个东西放在一起(将文本存储在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;

1 个答案:

答案 0 :(得分:3)

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

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

[Code]
procedure InitializeWizard();
begin
    WizardForm.InfoBeforeMemo.Color := clBlack;
end;