2

[次へ]、[戻る]ボタンが表示されている下部のパネルを、インストールの進行状況バーを含むカスタムパネルに置き換えたいと思います。インストールが完了すると、ページは自動的に次のページにリダイレクトされます。以下はモックアップ画像です。このページの作り方を教えてください。

ここに画像の説明を入力してください

4

1 に答える 1

6

これは、あなたのメインパネルヘッダーも含むスクリプトprevious questionです。..\InnoSetup\Examples\画像をPNGまたはJPG形式に変換しない信頼できるファイル共有サイトが見つからなかったため、BMPファイルに変換する必要がある次の画像と同様にフォルダに保存します。

  • this oneBMPに変換し、名前を付けて保存Logo.bmp
  • this oneBMPに変換し、名前を付けて保存InstallBackground.bmp

commented versionスクリプトは次のとおりです(最初にこのスクリプトに従う必要があります)。

[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;

そして、インストールページがどのように見えるかの結果(そしてはい、私はComicSansを使用しました:-)

ここに画像の説明を入力してください

于 2012-06-27T02:55:53.397 に答える