admin 发表于 2017-3-6 16:58:32

Inno Setuo 自定义图片背景图脚本




AppName=My Program
AppVersion=1.5
DefaultDirName={pf}My Program
DefaultGroupName=My Program


Source: "开始位图.bmp"; Flags: dontcopy
Source: "结束位图.bmp"; Flags: dontcopy
Source: "waterctrl.dll"; Flags: dontcopy
Source: "MyProg.exe"; DestDir: "{app}"


Filename: "{app}MyProg.exe"; Description: "运行我的程序"; Flags: postinstall


var
bmp: TBitmap;         
bmp1: TBitmap;            
CheckBox1: TCheckBox;

function enablewater(ParentWnd: HWND; Left, Top: integer; Bmp: HBITMAP; WaterRadius, WaterHeight: integer): BOOL;
external 'enablewater@files:waterctrl.dll stdcall';
function waterblob(x, y: integer; radius, height: integer): BOOL;
external 'waterblob@files:waterctrl.dll stdcall';
function flattenwater(): BOOL; external 'flattenwater@files:waterctrl.dll stdcall';
function disablewater(): BOOL; external 'disablewater@files:waterctrl.dll stdcall';
function setwaterparent(ParentWnd: HWND): BOOL; external 'setwaterparent@files:waterctrl.dll stdcall';

procedure InitializeWizard();
begin
ExtractTemporaryFile('开始位图.bmp');
ExtractTemporaryFile('结束位图.bmp');
bmp := TBitmap.create;
bmp.LoadFromFile(ExpandConstant('{tmp}开始位图.bmp'));
bmp1 := TBitmap.create;
bmp1.LoadFromFile(ExpandConstant('{tmp}结束位图.bmp'));
Wizardform.WelcomeLabel1.Visible:= false;//   屏蔽安装向导页面上面的文字
Wizardform.WelcomeLabel2.Visible:= false;//   屏蔽安装向导页面上面的文字
end;

procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID = wpWelcome then
    begin
    enablewater(WizardForm.WelcomePage.Handle, 0, 0, bmp.Handle, 3, 50);
    waterblob(70, 198, 10, 1000);
    end
else
    if CurPageID = wpFinished then
      begin
      waterblob(70, 198, 10, 1000);
      // 不显示原有文字
      Wizardform.FinishedHeadingLabel.Visible:= false;
      Wizardform.FinishedLabel.Visible:= false;
      Wizardform.RunList.Visible:= false;
      // 新建勾选项 1
      CheckBox1 := TCheckBox.Create(WizardForm);
      CheckBox1.Parent := WizardForm.FinishedPage;
      CheckBox1.Left := ScaleX(180);   // 位置要根据背景图像的情况进行调整
      CheckBox1.Top := ScaleY(220);      // 位置要根据背景图像的情况进行调整
      CheckBox1.Width := ScaleX(100);    // 宽度要根据文字多少进行调整
      CheckBox1.Height := ScaleY(15);
      CheckBox1.TabOrder := 0;
      CheckBox1.State := Wizardform.RunList.Checked;
      CheckBox1.Caption:= Wizardform.RunList.Items;
      end
    else
      flattenwater();
end;

procedure DeinitializeSetup();
begin
disablewater();
bmp.Free;
bmp1.Free;
end;

function NextButtonClick(CurPageID : Integer): Boolean;
begin
result:= true;
if CurPageID=wpFinished then
begin
wizardform.RunList.Checked := checkbox1.Checked;
end;
if CurPageID=wpReady then
begin
disablewater;                  // 关闭水波
enablewater(WizardForm.FinishedPage.Handle, 0, 0, bmp1.Handle, 3, 50); //新的水波
end;
end;

admin 发表于 2017-3-6 17:00:03




AppName=我的程序
AppVerName=我的程序 1.5
DefaultDirName={pf}我的程序
DefaultGroupName=我的程序
WizardImageFile=WizModernImage.bmp


Source: "MyProg.exe"; DestDir: "{app}"


Filename: "{app}MyProg.exe"; Description: "我的程序"; Flags: nowait postinstall skipifsilent


var
CheckBox1: TCheckBox;
newlabel: TLabel;

procedure InitializeWizard();
begin
CheckBox1 := TCheckBox.Create(WizardForm);
CheckBox1.Parent := WizardForm.FinishedPage;
CheckBox1.Left := 18
CheckBox1.Top := ScaleY(100);
CheckBox1.Width := ScaleY(15);
CheckBox1.Height := ScaleY(15);
CheckBox1.TabOrder := 0;
CheckBox1.State := cbChecked

WizardForm.WizardBitmapImage2.Width:= 479
WizardForm.WizardBitmapImage2.Height:= 290

// 不显示原有文字
Wizardform.FinishedHeadingLabel.Visible:= false;
Wizardform.FinishedLabel.Visible:= false;
// 添加透明文字
newlabel:= TLabel.Create(WizardForm);
newlabel.Parent := WizardForm.FinishedPage;
newlabel.Transparent:= true;
newlabel.Top := CheckBox1.Top + ScaleY(2);
newlabel.Left := CheckBox1.Left+ScaleX(20);
newlabel.Caption:= '运行 你的程序';
end;

procedure CurPageChanged(CurPageID : Integer);
begin
if CurPageID=wpFinished then
Wizardform.RunList.Visible:= false;
end;

function NextButtonClick(CurPageID : Integer): Boolean;
begin
result:= true;
if CurPageID=wpFinished then
wizardform.RunList.Checked:= checkbox1.Checked;
end;

页: [1]
查看完整版本: Inno Setuo 自定义图片背景图脚本