如何在inno setup ..中删除底部面板并将其替换为自定义面板 [英] How to remove the bottom panel in inno set up..and replace it with a custom panel

查看:86
本文介绍了如何在inno setup ..中删除底部面板并将其替换为自定义面板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要用显示安装进度条的自定义面板替换显示下一步",后退"按钮的底部面板.安装完成后,该页面应自动重定向到下一页. 下面是样机图片,我要如何创建此页面.

i want to replace the bottom panel where we show Next,Back buttons with a custom panel which includes the installation progress bar..once the installation is completed,then page should automatically redirected to next page. Below is mockup image,how i want to make this page.

推荐答案

以下是该脚本,还包括您 previous question .将其保存到您的..\InnoSetup\Examples\文件夹以及以下需要转换为BMP文件的图像中,因为我找不到任何不能将图像转换为PNG或JPG格式的受信任文件共享站点:

Here is the script including also the main panel header from your previous question as well. Save it into your ..\InnoSetup\Examples\ folder as well as the following images which you need to convert to BMP files since I couldn't find any trusted file sharing site which wouldn't convert the images to PNG or JPG format:

  • this one convert to BMP and save as Logo.bmp
  • this one convert to BMP and save as InstallBackground.bmp

这是脚本(您应首先遵循此脚本的 commented version ):

Here is the script (you should follow the commented version of this script first):

[Setup]
AppName=ERPBO
AppVersion=1.5
DefaultDirName={pf}\My Program
DefaultGroupName=My Program
UninstallDisplayIcon={app}\MyProg.exe
Compression=lzma2
SolidCompression=yes
OutputDir=userdocs:Inno Setup Examples Output
WizardSmallImageFile=Logo.bmp

[Files]
Source: "MyProg.exe"; DestDir: "{app}"
Source: "MyProg.chm"; DestDir: "{app}"
Source: "InstallBackground.bmp"; Flags: dontcopy

[Icons]
Name: "{group}\My Program"; Filename: "{app}\MyProg.exe"

[Run]
Filename: "{app}\MyProg.chm"; Check: JustBlockTheInstallPage

[Messages]
SetupWindowTitle=Installere - %1
WizardInstalling=Installasjon pågår...

[Code]
function JustBlockTheInstallPage: Boolean;
begin
  Result := False;  
  WizardForm.StatusLabel.Caption := 'Pakker ut filer...';
  WizardForm.FilenameLabel.Caption :='C:\dnpr\Crystal reports setup\WindowShoppingNet.msi';
  MsgBox('Message just to see the install page :-)', mbInformation, MB_OK);
end;

var
  InnerNotebookBounds: TRect;
  OuterNotebookBounds: TRect;
  InstallBottomPanel: TPanel;
  InstallBackground: TBitmapImage;

function Rect(const ALeft, ATop, ARight, ABottom: Integer): TRect;
begin
  Result.Left := ALeft;
  Result.Top := ATop;
  Result.Bottom := ABottom;
  Result.Right := ARight;
end;

function GetBoundsRect(AControl: TControl): TRect;
begin
  Result.Left := AControl.Left;
  Result.Top := AControl.Top;
  Result.Right := AControl.Left + AControl.Width;
  Result.Bottom := AControl.Top + AControl.Height;
end;

procedure SetBoundsRect(AControl: TControl; const ARect: TRect);
begin
  AControl.Left := ARect.Left;
  AControl.Top := ARect.Top;
  AControl.Width := ARect.Right - ARect.Left
  AControl.Height := ARect.Bottom - ARect.Top;
end;

procedure CenterHorizontally(ASource, ATarget: TControl);
begin
  ATarget.Left := (ASource.Width - ATarget.Width) div 2;
end;

procedure CenterVertically(ASource, ATarget: TControl);
begin
  ATarget.Top := (ASource.Height - ATarget.Height) div 2;  
end;

procedure InitializeWizard;
begin              
  WizardForm.PageDescriptionLabel.Visible := False;

  WizardForm.PageNameLabel.Font.Size := 18;
  WizardForm.PageNameLabel.Font.Name := 'Comic Sans MS';
  WizardForm.PageNameLabel.AutoSize := True;
  WizardForm.PageNameLabel.Left := 18;
  CenterVertically(WizardForm.MainPanel, WizardForm.PageNameLabel); 

  WizardForm.WizardSmallBitmapImage.AutoSize := True;
  WizardForm.WizardSmallBitmapImage.Left := WizardForm.ClientWidth - WizardForm.WizardSmallBitmapImage.Width - 18;
  CenterVertically(WizardForm.MainPanel, WizardForm.WizardSmallBitmapImage); 

  WizardForm.InstallingPage.Color := clWhite;  

  InstallBottomPanel := TPanel.Create(WizardForm);
  InstallBottomPanel.Parent := WizardForm.InstallingPage;
  InstallBottomPanel.BevelOuter := bvNone;
  InstallBottomPanel.Align := alBottom;
  InstallBottomPanel.Caption := '';
  InstallBottomPanel.Color := $00C7CFD3;
  InstallBottomPanel.Height := 79;
  InstallBottomPanel.ParentBackground := False;

  ExtractTemporaryFile('InstallBackground.bmp');

  InstallBackground := TBitmapImage.Create(WizardForm);
  InstallBackground.Parent := WizardForm.InstallingPage;
  InstallBackground.AutoSize := True;
  InstallBackground.Bitmap.LoadFromFile(ExpandConstant('{tmp}\InstallBackground.bmp'));

  WizardForm.StatusLabel.Parent := InstallBottomPanel;
  WizardForm.StatusLabel.Left := 8;
  WizardForm.StatusLabel.Top := 8;
  WizardForm.FilenameLabel.Parent := InstallBottomPanel;
  WizardForm.FilenameLabel.Left := 8;
  WizardForm.FilenameLabel.Top := WizardForm.StatusLabel.Top + 16;
  WizardForm.ProgressGauge.Parent := InstallBottomPanel;
  WizardForm.ProgressGauge.Left := 8;
  WizardForm.ProgressGauge.Top := WizardForm.FilenameLabel.Top + 26;

  InnerNotebookBounds := GetBoundsRect(WizardForm.InnerNotebook);
  OuterNotebookBounds := GetBoundsRect(WizardForm.OuterNotebook);
end;

procedure CurPageChanged(CurPageID: Integer);  
begin
  if CurPageID = wpInstalling then
  begin
    SetBoundsRect(WizardForm.OuterNotebook, Rect(OuterNotebookBounds.Left, 
      OuterNotebookBounds.Top, OuterNotebookBounds.Right, WizardForm.ClientHeight));
    SetBoundsRect(WizardForm.InnerNotebook, Rect(OuterNotebookBounds.Left,
      WizardForm.Bevel1.Top + WizardForm.Bevel1.Height, OuterNotebookBounds.Right, 
      WizardForm.ClientHeight));          

    CenterHorizontally(WizardForm.InstallingPage, InstallBackground);
    InstallBackground.Top := InstallBottomPanel.Top - InstallBackground.Height;
    WizardForm.ProgressGauge.Width := InstallBottomPanel.Width - 16;
  end
  else
  begin
    SetBoundsRect(WizardForm.OuterNotebook, OuterNotebookBounds);
    SetBoundsRect(WizardForm.InnerNotebook, InnerNotebookBounds);
  end;
end;

结果是安装页面的外观(是的,我用过Comic Sans:-)

And the result how the installation page looks like (and yes, I have used Comic Sans :-)

这篇关于如何在inno setup ..中删除底部面板并将其替换为自定义面板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆