问题描述
我正在尝试将InfoBefore文本文件的文本存储到变量中,然后使用自定义字体颜色和背景色将其加载到RTFEditor中.
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"
我需要一个明确的示例来说明如何将这两件事结合在一起(将文本存储在var中,使用自定义颜色和背景色将文本加载到RTF中),而又不会使事情变得过于复杂,因为我不知道Pascal
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.
这是代码:
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;
推荐答案
不要在事后尝试对其进行修改,只需将您的.txt文件加载到写字板中,进行所需的格式更改,然后将其保存为.rtf格式.然后,您可以直接使用此文件作为InfoBeforeFile
,而无需使用任何代码.
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.
如果要更改整个备忘录的背景颜色,则仍然需要一行代码.例如:
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;
这篇关于InnoSetup,如何将自定义文本加载到RTFText的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!