我正在使用 TRichEditViewer
在 Inno Setup 脚本中的自定义页面上。是否可以将外部 RTF 文件读入变量,并将该变量用作查看器的内容?或者我是否必须在脚本中保留实际的 RTF 代码?
感激地收到任何帮助。
最佳答案
您应该可以使用 LoadStringFromFile
阅读 RTF
文件转换成字符串。来自创新documentation :
Prototype:
function LoadStringFromFile(const FileName: String; var S: AnsiString): Boolean;
描述:
Loads the specified binary or non Unicode text file into the specified string. Returns True if successful, False otherwise.
您应该能够定义一个string
ANSI Inno Setup 或AnsiString
的类型变量使用以下内容为 Unicode Inno Setup 键入变量:然后在代码中:var #ifndef UNICODE rtfstr: string; #else rtfstr: AnsiString; #endif
然后使用类似于下面的代码。在这个例子中假设LoadStringFromFile('filenamehere.rtf', rtfstr);
oRichViewer
是TRichEditViewer
目的:这应该具有放置oRichViewer.UseRichEdit := True; oRichViewer.RTFText := rtfstr;
rtfstr
的效果我们之前从文件加载到TRichEditViewer
.
关于inno-setup - 为 TRichEditViewer 导入外部 RTF 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26209200/