Inno Setup技巧[介面]勾選式的協議頁面
本文介紹如何實現“勾選式的協議頁面。
介面預覽:
在[Code]段新增以下程式碼:
var
Label1: TLabel;
CheckBox1: TCheckBox;
procedure Cus_Next(Sender: TObject);
begin
if CheckBox1.Checked = True then
WizardForm.LicenseAcceptedRadio.Checked := True
else
WizardForm.LicenseNotAcceptedRadio.Checked := True
end;
procedure InitializeWizard();
begin
WizardForm.LicenseMemo.Height := 137;
WizardForm.LicenseAcceptedRadio.visible := False;
WizardForm.LicenseNotAcceptedRadio.visible := False;
Label1 := TLabel.Create(WizardForm);
Label1.Parent := WizardForm.LicensePage;
Label1.Left := WizardForm.LicenseMemo.Left;
Label1.Top := WizardForm.LicenseMemo.Top + WizardForm.LicenseMemo.Height + 7;
Label1.Width := WizardForm.LicenseMemo.Width;
Label1.Height := ScaleY(12);
Label1.Caption := '如果您接受許可協議,請點選下方的單選框。您必須接受協議才能安裝 MyProg'#13'1.0,單擊[下一步(N)]繼續。';
CheckBox1 := TCheckBox.Create(WizardForm);
CheckBox1.Parent := WizardForm.LicensePage;
CheckBox1.Left := WizardForm.LicenseMemo.Left;
CheckBox1.Top := WizardForm.LicenseMemo.Top + WizardForm.LicenseMemo.Height + 37;
CheckBox1.Width :=WizardForm.LicenseMemo.Width;
CheckBox1.Height := ScaleY(17);
CheckBox1.Caption := '我同意“許可協議”中的條款(&A)';
CheckBox1.TabOrder := 0;
CheckBox1.OnClick := @Cus_Next;
end;