问题
I'm trying to store the text of InfoBefore textfile into a variable and then load it into the RTFEditor with a custom font color and backcolor.
When I try to load the text from the variable it says "Write-only property"
I need a explicit example of how to do this two things together (Store the text in the var, load the text in the RTF with a custom color and backcolor) without complicating the things too much because I don't know Pascal.
This is the code:
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:
Instead of trying to modify it after the fact, simply load your .txt file in WordPad, make the formatting changes you require, then save it in .rtf format. You can then use this file as your InfoBeforeFile
directly, without using any code.
Edit: if you want to change the background colour of the entire memo then you'll still need one line of code. For example:
[Code]
procedure InitializeWizard();
begin
WizardForm.InfoBeforeMemo.Color := clBlack;
end;
来源:https://stackoverflow.com/questions/16123879/innosetup-how-to-load-a-custom-text-into-rtftext