带有换行符的Inno设置按钮标题

时间:2016-12-29 16:26:19

标签: inno-setup pascalscript

我正在尝试创建一个包含换行符的按钮标题:

Button.Caption := 'Line1' + #13#10 + 'Line2';

但是,标准换行符#13#10在这种情况下似乎不起作用,因为我得到了:

  

Line1Line2

显示在按钮上。在多行中打破按钮标题的正确语法是什么?

1 个答案:

答案 0 :(得分:2)

基于Newline character in caption of button(在Delphi中):

function GetWindowLong(Wnd: HWnd; Index: Integer): LongInt;
  external 'GetWindowLongW@user32.dll stdcall';
function SetWindowLong(Wnd: HWnd; Index: Integer; NewLong: LongInt): LongInt;
  external 'SetWindowLongW@user32.dll stdcall';

const
  GWL_STYLE = -16;
  BS_MULTILINE = $2000;

procedure InitializeWizard();
var
  Button: TNewButton;
begin
  Button := TNewButton.Create(WizardForm);
  Button.Left := ScaleX(16);
  Button.Top := WizardForm.NextButton.Top - ScaleX(8);
  Button.Width := WizardForm.NextButton.Width;
  Button.Height := WizardForm.NextButton.Height + ScaleY(16);
  Button.Parent := WizardForm;

  SetWindowLong(Button.Handle, GWL_STYLE, 
    GetWindowLong(Button.Handle, GWL_STYLE) or BS_MULTILINE);

  Button.Caption := 'foo' + #13#10 + 'bar';
end;

Button with new line