如何在 Inno Setup 中创建新的关于按钮?
How to create new About button in Inno Setup?
我想在 wpWelcome
、wpSelectTasks
、wpInstalling
等所有页面的左下角创建一个新的关于按钮;
如果单击它,将显示一些消息。如果用户按下 "OK",消息应该关闭。按钮应该显示完整的单词 "About" 而不是 "Abou..."
我已经检查了 Inno Setup 中的 CodeClasses.iss
文件,但我不明白我应该复制哪些代码,哪些不应该。
我已经看过这两个post:
- Adding a help button to an InnoSetup wizard page
- INNO Setup: "About" button position
但它们并不是我真正想要的。
所以请任何人帮助。
这是完成您所要求的所需最少代码的简化内联版本:
[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
[Code]
procedure AboutButtonOnClick(Sender: TObject);
begin
MsgBox('This is the about message!', mbInformation, mb_Ok);
end;
procedure InitializeWizard;
var
AboutButton: TNewButton;
begin
{ create an instance of the button and assign it to the local variable AboutButton }
AboutButton := TNewButton.Create(WizardForm);
{ set the parent to the just created button control }
AboutButton.Parent := WizardForm;
{ adjust the position to the created button control; it gets the horizontal indent }
{ by the right indent of the Cancel button; the vertical position as well as width }
{ and height are the same as the Cancel button has }
AboutButton.Left := WizardForm.ClientWidth - WizardForm.CancelButton.Left -
WizardForm.CancelButton.Width;
AboutButton.Top := WizardForm.CancelButton.Top;
AboutButton.Width := WizardForm.CancelButton.Width;
AboutButton.Height := WizardForm.CancelButton.Height;
{ set its caption }
AboutButton.Caption := '&About';
{ and assign the AboutButtonOnClick method to the OnClick event of the button }
AboutButton.OnClick := @AboutButtonOnClick;
end;
我想在 wpWelcome
、wpSelectTasks
、wpInstalling
等所有页面的左下角创建一个新的关于按钮;
如果单击它,将显示一些消息。如果用户按下 "OK",消息应该关闭。按钮应该显示完整的单词 "About" 而不是 "Abou..."
我已经检查了 Inno Setup 中的 CodeClasses.iss
文件,但我不明白我应该复制哪些代码,哪些不应该。
我已经看过这两个post:
- Adding a help button to an InnoSetup wizard page
- INNO Setup: "About" button position
但它们并不是我真正想要的。
所以请任何人帮助。
这是完成您所要求的所需最少代码的简化内联版本:
[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
[Code]
procedure AboutButtonOnClick(Sender: TObject);
begin
MsgBox('This is the about message!', mbInformation, mb_Ok);
end;
procedure InitializeWizard;
var
AboutButton: TNewButton;
begin
{ create an instance of the button and assign it to the local variable AboutButton }
AboutButton := TNewButton.Create(WizardForm);
{ set the parent to the just created button control }
AboutButton.Parent := WizardForm;
{ adjust the position to the created button control; it gets the horizontal indent }
{ by the right indent of the Cancel button; the vertical position as well as width }
{ and height are the same as the Cancel button has }
AboutButton.Left := WizardForm.ClientWidth - WizardForm.CancelButton.Left -
WizardForm.CancelButton.Width;
AboutButton.Top := WizardForm.CancelButton.Top;
AboutButton.Width := WizardForm.CancelButton.Width;
AboutButton.Height := WizardForm.CancelButton.Height;
{ set its caption }
AboutButton.Caption := '&About';
{ and assign the AboutButtonOnClick method to the OnClick event of the button }
AboutButton.OnClick := @AboutButtonOnClick;
end;