初始化窗口

1. 隐藏默认

  WizardForm.OuterNotebook.hide;  // 隐藏默认的导向内容
  WizardForm.Bevel.hide;          // 隐藏分隔线
  WizardForm.BorderStyle:=bsnone;  // 边界隐藏

2. 设置窗口大小

  WizardForm.Position:=poScreenCenter; // 位置屏幕居中
  WizardForm.Width:=630;               // 宽
  WizardForm.Height:=408;             // 高
  WizardForm.Color:=$00fd9804;        // 背景颜色

3. 定义窗口拖拽

  WizardForm.OnMouseDown:=@WizardMouseDown       //拖拽

  procedure WizardMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  begin
    ReleaseCapture
    SendMessage(WizardForm.Handle, $0112, $F012, 0)
  end;

4. 自定义页面图标添加事件

  ExtractTemporaryFile(\'btn_close.png\');
  ExtractTemporaryFile(\'btn_min.png\');

  // 取消安装
  CancelBtn:=BtnCreate(WizardForm.Handle,607,8,17,15,ExpandConstant(\'{tmp}\btn_close.png\'),2,False)
  BtnSetEvent(CancelBtn,BtnClickEventID,WrapBtnCallback(@CancelBtnOnClick,1));
	
  // 最小化窗口	
  MinBtn:=BtnCreate(WizardForm.Handle,587,4,17,15,ExpandConstant(\'{tmp}\btn_min.png\'),1,False)
  BtnSetEvent(MinBtn,BtnClickEventID,WrapBtnCallback(@MinBtnOnClick,1));

5. 背景

  // 背景颜色
  WizardForm.Color:=$00fd9804; // $00bgr

  // 背景图片
  ExtractTemporaryFile(\'xy.png\');
  BGimg:=ImgLoad(WizardForm.Handle,ExpandConstant(\'{tmp}\xy.png\'),0,0,650,408,false,false);
  ImgApplyChanges(WizardForm.Handle);

6. 向导页处理逻辑

  procedure CurPageChanged(CurPageID: Integer);
  begin
  
    WizardForm.NextButton.Visible:=false;
    WizardForm.CancelButton.Height:=0;
    WizardForm.BackButton.Height:=0;
  
    if CurPageID = wpWelcome then
  	WizardForm.NextButton.OnClick(WizardForm);
  end;

完整代码

[code]
#include  \'dll.iss\'

var CancelBtn, MinBtn:HWND;

// 取消按钮
procedure CancelBtnOnClick(hBtn:HWND);
begin
 WizardForm.CancelButton.Click;
end;

// 最小化按钮
procedure MinBtnOnClick(hBtn:HWND);
begin
SendMessage(WizardForm.Handle,WM_SYSCOMMAND,61472,0);
end;

// 拖拽
procedure WizardMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  ReleaseCapture
  SendMessage(WizardForm.Handle, $0112, $F012, 0)
end;

procedure InitializeWizard();

begin
  WizardForm.OuterNotebook.hide;  // 隐藏默认的导向内容
  WizardForm.Bevel.hide;          // 隐藏分隔线
  WizardForm.BorderStyle:=bsnone;  // 边界隐藏
  WizardForm.Position:=poScreenCenter; // 位置屏幕居中
  WizardForm.Width:=630;               // 宽
  WizardForm.Height:=408;             // 高
  WizardForm.Color:=$00fd9804;        // 背景颜色
  WizardForm.NextButton.hide;
  
  WizardForm.OnMouseDown:=@WizardMouseDown       //拖拽

  ExtractTemporaryFile(\'btn_close.png\');
  ExtractTemporaryFile(\'btn_min.png\');

  CancelBtn:=BtnCreate(WizardForm.Handle,607,8,17,15,ExpandConstant(\'{tmp}\btn_close.png\'),2,False)
  BtnSetEvent(CancelBtn,BtnClickEventID,WrapBtnCallback(@CancelBtnOnClick,1));

  MinBtn:=BtnCreate(WizardForm.Handle,587,4,17,15,ExpandConstant(\'{tmp}\btn_min.png\'),1,False)
  BtnSetEvent(MinBtn,BtnClickEventID,WrapBtnCallback(@MinBtnOnClick,1));

end;

procedure  DeinitializeSetup();
begin
   gdipShutdown;
end;

procedure CurPageChanged(CurPageID: Integer);
begin

  WizardForm.NextButton.Visible:=false;
  WizardForm.CancelButton.Height:=0;
  WizardForm.BackButton.Height:=0;

  if CurPageID = wpWelcome then
    WizardForm.NextButton.OnClick(WizardForm);
end;

版权声明:本文为pengsn原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/pengsn/archive/2004/01/13/13397269.html