InnoSetup, How to load a custom text into RTFText

淺唱寂寞╮ 提交于 2019-12-12 23:07:49

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!