将Inno Setup许可证备忘录切换到RTL模式



我正在用多种语言创建一个安装程序,有些语言需要RTL的指导才能自然地显示出来。这是我用于许可证页面的代码:

LicenseMemo := TNewMemo.Create(WizardForm);
with LicenseMemo do
begin
Parent     := WizardForm.LicensePage;
Left       := ScaleX(0);
Top        := ScaleY(50);
Width      := ScaleX(520);
Height     := ScaleY(210);
Color      := TColor($d3d3d3);
Font.Color := clBlack;
ScrollBars := ssVertical;
Text       := WizardForm.LicenseMemo.Text;
LicenseMemo.Font.Size := 12
ReadOnly   := True;
end;

我知道我可以通过将RightToLeft=yes添加到[LangOptions]来使程序完全RTL。但这让程序看起来很糟糕——我只需要RTL作为许可页面。有人能帮忙吗?我使用RTF文件作为许可证页面。

使用TRichEditViewer并将WS_EX_LAYOUTRTL添加到其GWL_EXSTYLE:

const 
GWL_EXSTYLE = -20;
WS_EX_LAYOUTRTL = $400000;
function GetWindowLong(hWnd: THandle; Index: Integer): LongInt;
external 'GetWindowLongW@User32.dll stdcall';
function SetWindowLong(hWnd: THandle; Index: Integer; NewLong: LongInt): LongInt;
external 'SetWindowLongW@user32.dll stdcall';
SetWindowLong(
RichEditViewer.Handle, GWL_EXSTYLE,
GetWindowLong(RichEditViewer.Handle, GWL_EXSTYLE) or WS_EX_LAYOUTRTL);

最新更新