2016-12-29 58 views
1

我試圖創建一個包含了換行符的按鈕標題:與線的Inno Setup按鈕標題打破

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

但是,標準的換行符#13#10不會出現在這種情況下工作,因爲我越來越:

Line1Line2

按鈕上顯示。在多行中打破按鈕標題的正確語法是什麼?

回答

2

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

function GetWindowLong(Wnd: HWnd; Index: Integer): LongInt; 
    external '[email protected] stdcall'; 
function SetWindowLong(Wnd: HWnd; Index: Integer; NewLong: LongInt): LongInt; 
    external '[email protected] 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