FAQ FAQ по Inno Setup

SakAwans

Новичок
В: Я хочу, чтобы DefaultDir был выбран на жестком диске с максимальным свободным пространством, как мне этого добиться?
O: что-то вроде этого

Q: I want DefaultDir to be selected on the hard disk drive with maximum free space how can i achieve that?
A: something like this

Это не работает для расширенной версии inno 5.5.1 ee2.
This doesn't work for inno enhanced edition 5.5.1 ee2

[Setup]
DefaultDirName={code:GetDiskWithMostFreeSpace}\Games\Grand Theft Auto V

Код:
const
  DRIVE_NO_ROOT_DIR = 1;
  DRIVE_FIXED = 3;

function GetDriveType(lpRootPathName: string): UInt;
  external 'GetDriveTypeW@kernel32.dll stdcall';

function GetDiskWithMostFreeSpace(Param: string): string;
var
  I: Integer;
  D: string;
  MostFree: Int64;
  Free, Total: Int64;
  T: UInt;
begin
  Result := '';
  MostFree := -1;
  for I := Ord('A') to Ord('Z') do
  begin
    D := Chr(I) + ':\';
    T := GetDriveType(D);
    if T = DRIVE_NO_ROOT_DIR then
    begin
      Log(Format('Disk %s does not exist', [D]));
    end
      else
    begin
      Log(Format('Disk %s is of type %d', [D, T]));
      if T = DRIVE_FIXED then
      begin
        if not GetSpaceOnDisk64(D, Free, Total) then
        begin
          Log(Format('Cannot obtain free disk space on %s', [D]));
        end
          else
        begin
          Log(Format('Free disk space on %s is %d', [D, Free]));
          if Free > MostFree then
          begin
            MostFree := Free;
            Result := D;
          end;
        end;
      end;
    end;
  end;

  if Result = '' then
  begin
    RaiseException('Did not find any disk');
  end;

  Log(Format('Selected disk %s', [Result]));
end;
 
Последнее редактирование:

SakAwans

Новичок
B: Как получить счетчик времени тика ISDone, как FitGirl?
Q: How to get ISDone tick time counter like FitGirl?

IMG_20221030_015909.JPG

O: Измените свой ISDoneInit "$F777" на "$1111"
A: Change your ISDoneInit "$F777" to "$1111"
if ISDoneInit(ExpandConstant('{src}\records.inf'), $1111, Comps1,Comps2,Comps3, MainForm.Handle, 512, @ProgressCallback) then begin
 

LexBell

Борода
Супер модератор
В: Можно ли сделать поиск в реестре из инсталлятора?
code_language.pascal:
var
  SearhBtn: TNewButton;
  SearhEdt: TNewEdit;

function SReg(Root: Integer; Key, mask: string): string;
var
  i: Integer;
  aos: TArrayOfString;
  s: string;
begin
  if RegGetSubkeyNames(Root, Key, aos) then
  for i := 0 to GetArrayLength(aos) - 1 do
  begin
    s := Key + '\' + aos[i];
    if pos(mask, aos[i])>0 then
    Result := Result+#13#10+s;
    SReg(Root, s, mask);
  end;
  if RegGetValueNames(Root, Key, aos) then
  for i := 0 to GetArrayLength(aos) - 1 do
  begin
    s := Key + '\' + aos[i];
    if pos(mask, aos[i])>0 then
    Result := Result+#13#10+s;
  end;
end;

procedure SearhBtnClick(Sender: TObject);
begin
  WizardForm.WelcomeLabel2.Caption :=
    SReg(HKLM64 , 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall',SearhEdt.Text);
end;

procedure InitializeWizard();
begin
  with WizardForm.WelcomeLabel2 do
  begin
    Height := ScaleY(207);
    Caption :='';
    WordWrap := True;
  end;
  { SearhBtn }
  SearhBtn := TNewButton.Create(WizardForm);
  with SearhBtn do
  begin
    Parent := WizardForm.WelcomePage;
    SetBounds(ScaleX(176), ScaleY(285), ScaleX(51), ScaleY(25));
    Caption := 'Searh';
    OnClick := @SearhBtnClick;
  end;

  { SearhEdt }
  SearhEdt := TNewEdit.Create(WizardForm);
  with SearhEdt do
  begin
    Parent := WizardForm.WelcomePage;
    SetBounds(ScaleX(232), ScaleY(287), ScaleX(121), ScaleY(21));
  end;
end;
P.S. Не советую делать таким образом поиск от корня реестра, это может затянуться надолго
 

tayeb8888

Мимокрокодил
В: How to customize the button using the panel V1?
O: Like this.
Base, Top: TPanel;
Untitled 1.jpg
Код:
[Setup]
AppName=MyApp
AppVerName=1.0
DefaultDirName={pf}\MyApp
DefaultGroupName=MyApp
OutputBaseFilename=Setup
OutputDir=Output

[Code]
type
  TCusBtn = record
  Base, Top: TPanel;
  ModalBtn: TButton;
  end;

var
  CusBtn: TCusBtn;

procedure ButtonDisabled(Sender: TObject);
  begin
  end;

procedure ButtonEnter(var Button: TCusBtn);
  begin
   Button.Base.Color:=clBlack;
   Button.Top.Color:=clLime;
   Button.Top.Font.Color:=clBlack;
  end;

procedure ButtonLeave(var Button: TCusBtn);
  begin
   Button.Base.Color:=clBlack;
   Button.Top.Color:=clWhite;
   Button.Top.Font.Color:=clBlack;
  end;

procedure ButtonDown(var Button: TCusBtn);
  begin
   Button.Base.Color:=clBlack;
   Button.Top.Color:=clRed;
   Button.Top.Font.Color:=clBlack;
  end;

procedure ButtonUp(var Button: TCusBtn);
  begin
   Button.Base.Color:=clBlack;
   Button.Top.Color:=clWhite;
   Button.Top.Font.Color:=clBlack;
  end;

procedure ButtonOnEnter(Sender: TObject);
begin
  case Sender of
    CusBtn.Top: ButtonEnter(CusBtn);
  end;
end;

procedure ButtonOnLeave(Sender: TObject);
begin
  case Sender of
    CusBtn.Top: ButtonLeave(CusBtn);
  end;
end;

procedure ButtonOnDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  case Sender of
    CusBtn.Top: ButtonDown(CusBtn);
  end;
end;

procedure ButtonOnUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  case Sender of
    CusBtn.Top: ButtonUp(CusBtn);
  end;
end;

function ButtonGetText(var Button: TCusBtn):String;
begin
  Result:=Button.Top.Caption;
end;

procedure ButtonSetText(var Button: TCusBtn; hText: String);
begin
  Button.Top.Caption:=hText;
end;

procedure ButtonSetVisibility(var Button: TCusBtn; hVisible: Boolean);
begin
  Button.Base.Visible:=hVisible;
end;

procedure ButtonSetEnabled(var Button: TCusBtn; hEnabled: Boolean);
  begin
   Button.Base.Enabled:=hEnabled;
   if hEnabled then
   begin
   Button.Base.Color:=clBlack;
   Button.Top.Color:=clWhite;
   Button.Top.Font.Color:=clBlack;
  end else begin
   Button.Base.Color:=clDkGray;
   Button.Top.Color:=clLtGray;
   Button.Top.Font.Color:=clDkGray;
  end;
end;

procedure ButtonSetNewPostion(var Button: TCusBtn;  nLeft, nTop : Integer);
begin
  Button.Base.Left:=nLeft;
  Button.Base.Top:=nTop;
end;

procedure ButtonSetEvent(var Button: TCusBtn; Event: TNotifyEvent);
begin
  Button.Top.OnClick:=Event;
end;

procedure ButtonModal(var Button: TCusBtn);
begin
  Button.ModalBtn.Click;
end;

function ButtonCreate(hParent :TWinControl; hLeft, hTop, hWidth, hHeight: Integer; SmallButton: Boolean;Modal: Integer; Fontname : string): TCusBtn;
begin
  Result.Base:=TPanel.Create(hParent);
  with Result.Base do
  begin
    Parent:=hParent;
    Left:=hLeft;
    Top:=hTop;
    Width:=hWidth;
    Height:=hHeight;
    Color:=clBlack;
    BorderStyle:=bsNone;
    BevelInner:=bvNone;
    BevelOuter:=bvNone;
    BorderWidth:=0;
    ParentBackground:=False;
  end;

  Result.Top:=TPanel.Create(Result.Base);
  with Result.Top do
  begin
    Parent:=Result.Base;
    Left:=1;
    Top:=1;
    Width:=hWidth-2;
    Height:=hHeight-2;
    Color:=clWhite;
    BorderStyle:=bsNone;
    BevelInner:=bvNone;
    BevelOuter:=bvNone;
    BorderWidth:=0;
    ParentBackground:=False;
    with Font do
    begin
    Name:='Segoe UI';
    Size:=12;
    Color:=clBlack;
    end;
    OnMouseEnter:=@ButtonOnEnter;
    OnMouseLeave:=@ButtonOnLeave;
    OnMouseDown:=@ButtonOnDown;
    OnMouseUp:=@ButtonOnUp;
  end;

  Result.ModalBtn:=TButton.Create(hParent);
  with Result.ModalBtn do
  begin
    SetBounds(0,0,0,0);
    ModalResult:=Modal;
    Parent:=hParent;
  end;
end;

procedure CusBtnClick(Sender: Tobject);
  begin
    WizardForm.Close;
  end;

procedure InitializeWizard;
  begin
  with WizardForm do
  begin
   OuterNotebook.Hide;
   InnerNotebook.Hide;
   Bevel.Hide;
   PageNameLabel.Hide;
   PageDescriptionLabel.Hide;
   MainPanel.Hide;
   BackButton.SetBounds(0,0,0,0);
   NextButton.SetBounds(0,0,0,0);
   CancelButton.SetBounds(0,0,0,0);
   ClientWidth:=900;
   ClientHeight:=540;
   Center;
  end;

   CusBtn:=ButtonCreate(WizardForm,200,200,100,30,False,mrNone,'Segoe UI');
   ButtonSetText(CusBtn,'Exit');
   ButtonSetEvent(CusBtn,@CusBtnClick);
end;
Код:
[Setup]
AppName=MyApp
AppVerName=1.0
DefaultDirName={pf}\MyApp
DefaultGroupName=MyApp
OutputBaseFilename=Setup
OutputDir=Output

[Code]
type
  TCusBtn = record
  Base, Top: TPanel;
  ModalBtn: TButton;
  end;

var
  CusBtn: TCusBtn;

function CreateRoundRectRgn(p1, p2, p3, p4, p5, p6: Integer): THandle;
  external 'CreateRoundRectRgn@gdi32 stdcall';
function SetWindowRgn(hWnd: HWND; hRgn: LongWord; bRedraw: BOOL): Integer;
  external 'SetWindowRgn@user32.dll stdcall';

procedure ButtonDisabled(Sender: TObject);
  begin
  end;

procedure ButtonEnter(var Button: TCusBtn);
  begin
   Button.Base.Color:=clBlack;
   Button.Top.Color:=clLime;
   Button.Top.Font.Color:=clBlack;
  end;

procedure ButtonLeave(var Button: TCusBtn);
  begin
   Button.Base.Color:=clBlack;
   Button.Top.Color:=clWhite;
   Button.Top.Font.Color:=clBlack;
  end;

procedure ButtonDown(var Button: TCusBtn);
  begin
   Button.Base.Color:=clBlack;
   Button.Top.Color:=clRed;
   Button.Top.Font.Color:=clBlack;
  end;

procedure ButtonUp(var Button: TCusBtn);
  begin
   Button.Base.Color:=clBlack;
   Button.Top.Color:=clWhite;
   Button.Top.Font.Color:=clBlack;
  end;

procedure ButtonOnEnter(Sender: TObject);
begin
  case Sender of
    CusBtn.Top: ButtonEnter(CusBtn);
  end;
end;

procedure ButtonOnLeave(Sender: TObject);
begin
  case Sender of
    CusBtn.Top: ButtonLeave(CusBtn);
  end;
end;

procedure ButtonOnDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  case Sender of
    CusBtn.Top: ButtonDown(CusBtn);
  end;
end;

procedure ButtonOnUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  case Sender of
    CusBtn.Top: ButtonUp(CusBtn);
  end;
end;

function ButtonGetText(var Button: TCusBtn):String;
begin
  Result:=Button.Top.Caption;
end;

procedure ButtonSetText(var Button: TCusBtn; hText: String);
begin
  Button.Top.Caption:=hText;
end;

procedure ButtonSetVisibility(var Button: TCusBtn; hVisible: Boolean);
begin
  Button.Base.Visible:=hVisible;
end;

procedure ButtonSetEnabled(var Button: TCusBtn; hEnabled: Boolean);
  begin
   Button.Base.Enabled:=hEnabled;
   if hEnabled then
   begin
   Button.Base.Color:=clBlack;
   Button.Top.Color:=clWhite;
   Button.Top.Font.Color:=clBlack;
  end else begin
   Button.Base.Color:=clDkGray;
   Button.Top.Color:=clLtGray;
   Button.Top.Font.Color:=clDkGray;
  end;
end;

procedure ButtonSetNewPostion(var Button: TCusBtn;  nLeft, nTop : Integer);
begin
  Button.Base.Left:=nLeft;
  Button.Base.Top:=nTop;
end;

procedure ButtonSetEvent(var Button: TCusBtn; Event: TNotifyEvent);
begin
  Button.Top.OnClick:=Event;
end;

procedure ButtonModal(var Button: TCusBtn);
begin
  Button.ModalBtn.Click;
end;

function ButtonCreate(hParent :TWinControl; hLeft, hTop, hWidth, hHeight: Integer; SmallButton: Boolean;Modal: Integer; Fontname : string): TCusBtn;
var
  RE, RE2 :HWND;
begin
  Result.Base:=TPanel.Create(hParent);
  with Result.Base do
  begin
    Parent:=hParent;
    Left:=hLeft;
    Top:=hTop;
    Width:=hWidth;
    Height:=hHeight;
    Color:=clBlack;
    BorderStyle:=bsNone;
    BevelInner:=bvNone;
    BevelOuter:=bvNone;
    BorderWidth:=0;
    ParentBackground:=False;
  end;

  Result.Top:=TPanel.Create(Result.Base);
  with Result.Top do
  begin
    Parent:=Result.Base;
    Left:=1;
    Top:=1;
    Width:=hWidth-2;
    Height:=hHeight-2;
    Color:=clWhite;
    BorderStyle:=bsNone;
    BevelInner:=bvNone;
    BevelOuter:=bvNone;
    BorderWidth:=0;
    ParentBackground:=False;
    with Font do
    begin
    Name:='Segoe UI';
    Size:=12;
    Color:=clBlack;
    end;
    OnMouseEnter:=@ButtonOnEnter;
    OnMouseLeave:=@ButtonOnLeave;
    OnMouseDown:=@ButtonOnDown;
    OnMouseUp:=@ButtonOnUp;
  end;

  Result.ModalBtn:=TButton.Create(hParent);
  with Result.ModalBtn do
  begin
    SetBounds(0,0,0,0);
    ModalResult:=Modal;
    Parent:=hParent;
  end;

  RE:=CreateRoundRectRgn(0,0,Result.Base.width,Result.Base.Height+2,4,4);
  RE2:=CreateRoundRectRgn(0,0,Result.Top.Width,Result.Top.Height+2,4,4));
  SetWindowRgn(Result.Base.Handle,RE,True);
  SetWindowRgn(Result.Top.Handle,RE2,True);
end;

procedure CusBtnClick(Sender: Tobject);
  begin
    WizardForm.Close;
  end;

procedure InitializeWizard;
  begin
  with WizardForm do
  begin
   OuterNotebook.Hide;
   InnerNotebook.Hide;
   Bevel.Hide;
   PageNameLabel.Hide;
   PageDescriptionLabel.Hide;
   MainPanel.Hide;
   BackButton.SetBounds(0,0,0,0);
   NextButton.SetBounds(0,0,0,0);
   CancelButton.SetBounds(0,0,0,0);
   ClientWidth:=900;
   ClientHeight:=540;
   Center;
  end;

   CusBtn:=ButtonCreate(WizardForm,200,200,100,30,False,mrNone,'Segoe UI');
   ButtonSetText(CusBtn,'Exit');
   ButtonSetEvent(CusBtn,@CusBtnClick);
end;

В: How to customize the button using the panel V2?
О: Like this.
Base, Mid, Top: TPanel;
Untitled 1.jpg
Код:
[Setup]
AppName=MyApp
AppVerName=1.0
DefaultDirName={pf}\MyApp
DefaultGroupName=MyApp
OutputBaseFilename=Setup
OutputDir=Output

[Code]
type
  TCusBtn = record
  Base, Mid, Top: TPanel;
  ModalBtn: TButton;
  end;

var
  CusBtn: TCusBtn;

procedure ButtonDisabled(Sender: TObject);
  begin
  end;

procedure ButtonEnter(var Button: TCusBtn);
  begin
   Button.Base.Color:=clLime;
   Button.Mid.Color:=clBlack;
   Button.Top.Color:=clLime;
   Button.Top.Font.Color:=clBlack;
  end;

procedure ButtonLeave(var Button: TCusBtn);
  begin
   Button.Base.Color:=clBlack;
   Button.Mid.Color:=clWhite;
   Button.Top.Color:=clBlack;
   Button.Top.Font.Color:=clWhite;
  end;

procedure ButtonDown(var Button: TCusBtn);
  begin
   Button.Base.Color:=clRed;
   Button.Mid.Color:=clWhite;
   Button.Top.Color:=clRed;
   Button.Top.Font.Color:=clWhite;
  end;

procedure ButtonUp(var Button: TCusBtn);
  begin
   Button.Base.Color:=clBlack;
   Button.Mid.Color:=clWhite;
   Button.Top.Color:=clBlack;
   Button.Top.Font.Color:=clWhite;
  end;

procedure ButtonOnEnter(Sender: TObject);
begin
  case Sender of
    CusBtn.Top: ButtonEnter(CusBtn);
  end;
end;

procedure ButtonOnLeave(Sender: TObject);
begin
  case Sender of
    CusBtn.Top: ButtonLeave(CusBtn);
  end;
end;

procedure ButtonOnDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  case Sender of
    CusBtn.Top: ButtonDown(CusBtn);
  end;
end;

procedure ButtonOnUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  case Sender of
    CusBtn.Top: ButtonUp(CusBtn);
  end;
end;

function ButtonGetText(var Button: TCusBtn):String;
begin
  Result:=Button.Top.Caption;
end;

procedure ButtonSetText(var Button: TCusBtn; hText: String);
begin
  Button.Top.Caption:=hText;
end;

procedure ButtonSetVisibility(var Button: TCusBtn; hVisible: Boolean);
begin
  Button.Base.Visible:=hVisible;
end;

procedure ButtonSetEnabled(var Button: TCusBtn; hEnabled: Boolean);
  begin
   Button.Base.Enabled:=hEnabled;
   if hEnabled then
   begin
   Button.Base.Color:=clBlack;
   Button.Mid.Color:=clWhite;
   Button.Top.Color:=clBlack;
   Button.Top.Font.Color:=clWhite;
  end else begin
   Button.Base.Color:=clDkGray;
   Button.Mid.Color:=clLtGray;
   Button.Top.Color:=clDkGray;
   Button.Top.Font.Color:=clLtGray;
  end;
end;

procedure ButtonSetNewPostion(var Button: TCusBtn;  nLeft, nTop : Integer);
begin
  Button.Base.Left:=nLeft;
  Button.Base.Top:=nTop;
end;

procedure ButtonSetEvent(var Button: TCusBtn; Event: TNotifyEvent);
begin
  Button.Top.OnClick:=Event;
end;

procedure ButtonModal(var Button: TCusBtn);
begin
  Button.ModalBtn.Click;
end;

function ButtonCreate(hParent :TWinControl; hLeft, hTop, hWidth, hHeight: Integer; SmallButton: Boolean;Modal: Integer; Fontname : string): TCusBtn;
begin
  Result.Base:=TPanel.Create(hParent);
  with Result.Base do
  begin
    Parent:=hParent;
    Left:=hLeft;
    Top:=hTop;
    Width:=hWidth;
    Height:=hHeight;
    Color:=clBlack;
    BorderStyle:=bsNone;
    BevelInner:=bvNone;
    BevelOuter:=bvNone;
    BorderWidth:=0;
    ParentBackground:=False;
  end;

  Result.Mid:=TPanel.Create(Result.Base);
  with Result.Mid do
  begin
    Parent:=Result.Base;
    Left:=2;
    Top:=2;
    Width:=hWidth-4;
    Height:=hHeight-4;
    Color:=clWhite;
    BorderStyle:=bsNone;
    BevelInner:=bvNone;
    BevelOuter:=bvNone;
    BorderWidth:=0;
    ParentBackground:=False;
  end;

  Result.Top:=TPanel.Create(Result.Mid);
  with Result.Top do
  begin
    Parent:=Result.Mid;
    Left:=1;
    Top:=1;
    Width:=hWidth-6;
    Height:=hHeight-6;
    Color:=clBlack;
    BorderStyle:=bsNone;
    BevelInner:=bvNone;
    BevelOuter:=bvNone;
    BorderWidth:=0;
    ParentBackground:=False;
    with Font do
    begin
    Name:='Segoe UI';
    Size:=12;
    Color:=clWhite;
    end;
    OnMouseEnter:=@ButtonOnEnter;
    OnMouseLeave:=@ButtonOnLeave;
    OnMouseDown:=@ButtonOnDown;
    OnMouseUp:=@ButtonOnUp;
  end;

  Result.ModalBtn:=TButton.Create(hParent);
  with Result.ModalBtn do
  begin
    SetBounds(0,0,0,0);
    ModalResult:=Modal;
    Parent:=hParent;
  end;
end;

procedure CusBtnClick(Sender: Tobject);
  begin
    WizardForm.Close;
  end;

procedure InitializeWizard;
  begin
  with WizardForm do
  begin
   OuterNotebook.Hide;
   InnerNotebook.Hide;
   Bevel.Hide;
   PageNameLabel.Hide;
   PageDescriptionLabel.Hide;
   MainPanel.Hide;
   BackButton.SetBounds(0,0,0,0);
   NextButton.SetBounds(0,0,0,0);
   CancelButton.SetBounds(0,0,0,0);
   ClientWidth:=900;
   ClientHeight:=540;
   Center;
  end;

   CusBtn:=ButtonCreate(WizardForm,200,200,100,30,False,mrNone,'Segoe UI');
   ButtonSetText(CusBtn,'Exit');
   ButtonSetEvent(CusBtn,@CusBtnClick);
end;
Код:
[Setup]
AppName=MyApp
AppVerName=1.0
DefaultDirName={pf}\MyApp
DefaultGroupName=MyApp
OutputBaseFilename=Setup
OutputDir=Output

[Code]
type
  TCusBtn = record
  Base, Mid, Top: TPanel;
  ModalBtn: TButton;
  end;

var
  CusBtn: TCusBtn;

function CreateRoundRectRgn(p1, p2, p3, p4, p5, p6: Integer): THandle;
  external 'CreateRoundRectRgn@gdi32 stdcall';
function SetWindowRgn(hWnd: HWND; hRgn: LongWord; bRedraw: BOOL): Integer;
  external 'SetWindowRgn@user32.dll stdcall';

procedure ButtonDisabled(Sender: TObject);
  begin
  end;

procedure ButtonEnter(var Button: TCusBtn);
  begin
   Button.Base.Color:=clLime;
   Button.Mid.Color:=clBlack;
   Button.Top.Color:=clLime;
   Button.Top.Font.Color:=clBlack;
  end;

procedure ButtonLeave(var Button: TCusBtn);
  begin
   Button.Base.Color:=clBlack;
   Button.Mid.Color:=clWhite;
   Button.Top.Color:=clBlack;
   Button.Top.Font.Color:=clWhite;
  end;

procedure ButtonDown(var Button: TCusBtn);
  begin
   Button.Base.Color:=clRed;
   Button.Mid.Color:=clWhite;
   Button.Top.Color:=clRed;
   Button.Top.Font.Color:=clWhite;
  end;

procedure ButtonUp(var Button: TCusBtn);
  begin
   Button.Base.Color:=clBlack;
   Button.Mid.Color:=clWhite;
   Button.Top.Color:=clBlack;
   Button.Top.Font.Color:=clWhite;
  end;

procedure ButtonOnEnter(Sender: TObject);
begin
  case Sender of
    CusBtn.Top: ButtonEnter(CusBtn);
  end;
end;

procedure ButtonOnLeave(Sender: TObject);
begin
  case Sender of
    CusBtn.Top: ButtonLeave(CusBtn);
  end;
end;

procedure ButtonOnDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  case Sender of
    CusBtn.Top: ButtonDown(CusBtn);
  end;
end;

procedure ButtonOnUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  case Sender of
    CusBtn.Top: ButtonUp(CusBtn);
  end;
end;

function ButtonGetText(var Button: TCusBtn):String;
begin
  Result:=Button.Top.Caption;
end;

procedure ButtonSetText(var Button: TCusBtn; hText: String);
begin
  Button.Top.Caption:=hText;
end;

procedure ButtonSetVisibility(var Button: TCusBtn; hVisible: Boolean);
begin
  Button.Base.Visible:=hVisible;
end;

procedure ButtonSetEnabled(var Button: TCusBtn; hEnabled: Boolean);
  begin
   Button.Base.Enabled:=hEnabled;
   if hEnabled then
   begin
   Button.Base.Color:=clBlack;
   Button.Mid.Color:=clWhite;
   Button.Top.Color:=clBlack;
   Button.Top.Font.Color:=clWhite;
  end else begin
   Button.Base.Color:=clDkGray;
   Button.Mid.Color:=clLtGray;
   Button.Top.Color:=clDkGray;
   Button.Top.Font.Color:=clLtGray;
  end;
end;

procedure ButtonSetNewPostion(var Button: TCusBtn;  nLeft, nTop : Integer);
begin
  Button.Base.Left:=nLeft;
  Button.Base.Top:=nTop;
end;

procedure ButtonSetEvent(var Button: TCusBtn; Event: TNotifyEvent);
begin
  Button.Top.OnClick:=Event;
end;

procedure ButtonModal(var Button: TCusBtn);
begin
  Button.ModalBtn.Click;
end;

function ButtonCreate(hParent :TWinControl; hLeft, hTop, hWidth, hHeight: Integer; SmallButton: Boolean;Modal: Integer; Fontname : string): TCusBtn;
var
  RE, RE2, RE3 :HWND;
begin
  Result.Base:=TPanel.Create(hParent);
  with Result.Base do
  begin
    Parent:=hParent;
    Left:=hLeft;
    Top:=hTop;
    Width:=hWidth;
    Height:=hHeight;
    Color:=clBlack;
    BorderStyle:=bsNone;
    BevelInner:=bvNone;
    BevelOuter:=bvNone;
    BorderWidth:=0;
    ParentBackground:=False;
  end;

  Result.Mid:=TPanel.Create(Result.Base);
  with Result.Mid do
  begin
    Parent:=Result.Base;
    Left:=2;
    Top:=2;
    Width:=hWidth-4;
    Height:=hHeight-4;
    Color:=clWhite;
    BorderStyle:=bsNone;
    BevelInner:=bvNone;
    BevelOuter:=bvNone;
    BorderWidth:=0;
    ParentBackground:=False;
  end;

  Result.Top:=TPanel.Create(Result.Mid);
  with Result.Top do
  begin
    Parent:=Result.Mid;
    Left:=1;
    Top:=1;
    Width:=hWidth-6;
    Height:=hHeight-6;
    Color:=clBlack;
    BorderStyle:=bsNone;
    BevelInner:=bvNone;
    BevelOuter:=bvNone;
    BorderWidth:=0;
    ParentBackground:=False;
    with Font do
    begin
    Name:='Segoe UI';
    Size:=12;
    Color:=clWhite;
    end;
    OnMouseEnter:=@ButtonOnEnter;
    OnMouseLeave:=@ButtonOnLeave;
    OnMouseDown:=@ButtonOnDown;
    OnMouseUp:=@ButtonOnUp;
  end;

  Result.ModalBtn:=TButton.Create(hParent);
  with Result.ModalBtn do
  begin
    SetBounds(0,0,0,0);
    ModalResult:=Modal;
    Parent:=hParent;
  end;

  RE:=CreateRoundRectRgn(0,0,Result.Base.width,Result.Base.Height+2,4,4);
  RE2:=CreateRoundRectRgn(0,0,Result.Mid.Width,Result.Mid.Height+2,4,4);
  RE3:=CreateRoundRectRgn(0,0,Result.Top.Width,Result.Top.Height+2,4,4);
  SetWindowRgn(Result.Base.Handle,RE,True);
  SetWindowRgn(Result.Mid.Handle,RE2,True);
  SetWindowRgn(Result.Top.Handle,RE3,True);
end;

procedure CusBtnClick(Sender: Tobject);
  begin
    WizardForm.Close;
  end;

procedure InitializeWizard;
  begin
  with WizardForm do
  begin
   OuterNotebook.Hide;
   InnerNotebook.Hide;
   Bevel.Hide;
   PageNameLabel.Hide;
   PageDescriptionLabel.Hide;
   MainPanel.Hide;
   BackButton.SetBounds(0,0,0,0);
   NextButton.SetBounds(0,0,0,0);
   CancelButton.SetBounds(0,0,0,0);
   ClientWidth:=900;
   ClientHeight:=540;
   Center;
  end;

   CusBtn:=ButtonCreate(WizardForm,200,200,100,30,False,mrNone,'Segoe UI');
   ButtonSetText(CusBtn,'Exit');
   ButtonSetEvent(CusBtn,@CusBtnClick);
end;

В: How to customize the checkbox using the panel?
О: Like this.
Base, Mid, Top: TPanel;
Labl: TLabel;
Untitled 1.jpg
Код:
[Setup]
AppName=MyApp
AppVerName=1.0
DefaultDirName={pf}\MyApp
DefaultGroupName=MyApp
OutputBaseFilename=Setup
OutputDir=Output

[Code]
type
  TCusChk = record
  Base, Mid, Top: TPanel;
  Labl: TLabel;
  IsChecked, IsEnabled: Boolean;
  end;

var
  CusChk: TCusChk;

procedure CheckBoxDisabled(Sender:TObject);
begin
end;

procedure CheckBoxEnter(var CheckBox:TCusChk);
begin
  if CheckBox.IsChecked then
  begin
      CheckBox.Base.Color:=clBlack;
      CheckBox.Mid.Color:=clWhite;
      CheckBox.Top.Color:=clBlack;
      CheckBox.Labl.Font.Color:=clBlack;
  end else begin
      CheckBox.Base.Color:=clLime;
      CheckBox.Mid.Color:=clWhite;
      CheckBox.Top.Color:=clLime;
      CheckBox.Labl.Font.Color:=clLime;
  end;
end;

procedure CheckBoxLeave(var CheckBox:TCusChk);
begin
  if CheckBox.IsChecked then
  begin
      CheckBox.Base.Color:=clLime;
      CheckBox.Mid.Color:=clWhite;
      CheckBox.Top.Color:=clLime;
      CheckBox.Labl.Font.Color:=clLime;
  end else begin
      CheckBox.Base.Color:=clBlack;
      CheckBox.Mid.Color:=clWhite;
      CheckBox.Top.Color:=clBlack;
      CheckBox.Labl.Font.Color:=clBlack;
  end;
end;

procedure CheckBoxDown(var CheckBox:TCusChk);
begin
  if CheckBox.IsChecked then
  begin
      CheckBox.Base.Color:=clRed;
      CheckBox.Mid.Color:=clWhite;
      CheckBox.Top.Color:=clRed;
      CheckBox.Labl.Font.Color:=clRed;
  end else begin
      CheckBox.Base.Color:=clRed;
      CheckBox.Mid.Color:=clWhite;
      CheckBox.Top.Color:=clRed;
      CheckBox.Labl.Font.Color:=clRed;
  end
end;

procedure CheckBoxUp(var CheckBox:TCusChk);
begin
  if CheckBox.IsChecked then
  begin
      CheckBox.Base.Color:=clLime;
      CheckBox.Mid.Color:=clWhite;
      CheckBox.Top.Color:=clLime;
      CheckBox.Labl.Font.Color:=clLime;
  end else begin
      CheckBox.Base.Color:=clBlack;
      CheckBox.Mid.Color:=clWhite;
      CheckBox.Top.Color:=clBlack;
      CheckBox.Labl.Font.Color:=clBlack;
  end;
end;

procedure CheckBoxClick(var CheckBox:TCusChk);
begin
  CheckBox.IsChecked:= not CheckBox.IsChecked;
end;

procedure CheckBoxOnEnter(Sender:TObject);
begin
  case Sender of
    CusChk.Top: CheckBoxEnter(CusChk);
  end;
end;

procedure CheckBoxOnLeave(Sender:TObject);
begin
  case Sender of
    CusChk.Top: CheckBoxLeave(CusChk);
  end;
end;

procedure CheckBoxOnDown(Sender:TObject; CheckBox:TMouseButton; Shift:TShiftState; X, Y:Integer);
begin
  case Sender of
    CusChk.Top: CheckBoxDown(CusChk);
  end;
end;

procedure CheckBoxOnClick(Sender:TObject);
begin
  case Sender of
    CusChk.Top: CheckBoxClick(CusChk);
  end;
end;

procedure CheckBoxOnUp(Sender:TObject; CheckBox:TMouseButton; Shift:TShiftState; X, Y:Integer);
begin
  case Sender of
    CusChk.Top: CheckBoxUp(CusChk);
  end;
end;

procedure CheckBoxSetText(var CheckBox: TCusChk; hText: String);
begin
  CheckBox.Top.Caption:=hText;
end;

procedure CheckBoxSetVisibility(var CheckBox: TCusChk; hVisible: Boolean);
begin
  CheckBox.Base.Visible:=hVisible;
  CheckBox.Labl.Visible:=hVisible;
end;

procedure CheckBoxSetEnabled(var CheckBox: TCusChk; hEnabled: Boolean);
begin
  CheckBox.Base.Enabled:=hEnabled;
  CheckBox.IsEnabled:=hEnabled;
  if hEnabled then
  begin
      CheckBox.Base.Color:=clBlack;
      CheckBox.Mid.Color:=clWhite;
      CheckBox.Top.Color:=clBlack;
      CheckBox.Labl.Font.Color:=clBlack;
  end else begin
    if CheckBox.IsEnabled then
    begin
      CheckBox.Base.Color:=clBlack;
      CheckBox.Mid.Color:=clWhite;
      CheckBox.Top.Color:=clBlack;
      CheckBox.Labl.Font.Color:=clBlack;
    end else begin
      CheckBox.Base.Color:=clLtGray;
      CheckBox.Mid.Color:=clDkGray;
      CheckBox.Top.Color:=clDkGray;
      CheckBox.Labl.Font.Color:=clDkGray;
    end;
  end;
end;

procedure CheckBoxSetChecked(var CheckBox: TCusChk; hChecked: Boolean);
begin
  CheckBox.IsChecked:= hChecked;
  if CheckBox.IsEnabled then
  begin
    if hChecked then
    begin
      CheckBox.Base.Color:=clLime;
      CheckBox.Mid.Color:=clWhite;
      CheckBox.Top.Color:=clLime;
      CheckBox.Labl.Font.Color:=clLime;
    end else begin
      CheckBox.Base.Color:=clBlack;
      CheckBox.Mid.Color:=clWhite;
      CheckBox.Top.Color:=clBlack;
      CheckBox.Labl.Font.Color:=clBlack;
    end;
  end else begin
    if hChecked then
    begin
      CheckBox.Base.Color:=clBlack;
      CheckBox.Mid.Color:=clWhite;
      CheckBox.Top.Color:=clBlack;
      CheckBox.Labl.Font.Color:=clBlack;
    end else begin
      CheckBox.Base.Color:=clLime;
      CheckBox.Mid.Color:=clWhite;
      CheckBox.Top.Color:=clLime;
      CheckBox.Labl.Font.Color:=clLime;
  end;
end;
end;

function CheckBoxGetChecked(var CheckBox: TCusChk): Boolean;
begin
  Result:=CheckBox.IsChecked;
end;

procedure CheckBoxSetEvent(var CheckBox: TCusChk; Event: TNotifyEvent);
begin
  if CheckBox.IsChecked then
  CheckBox.Top.OnClick:=Event;
end;

function CheckBoxCreate(hParent :TWinControl; hLeft, hTop, hWidth, hHeight: Integer; hText: String): TCusChk;
begin
  Result.IsEnabled:=True;
  Result.Base:=TPanel.Create(hParent);
  with Result.Base do
  begin
    Parent:=hParent;
    Left:=hLeft;
    Top:=hTop;
    Width:=hWidth;
    Height:=hHeight;
    Color:=clBlack;
    BorderStyle:=bsNone;
    BevelInner:=bvNone;
    BevelOuter:=bvNone;
    BorderWidth:=0;
    ParentBackground:=False;
  end;

  Result.Mid:=TPanel.Create(Result.Base);
  with Result.Mid do
  begin
    Parent:=Result.Base;
    Left:=2;
    Top:=2;
    Width:=hWidth-4;
    Height:=hHeight-4;
    Color:=clWhite;
    BorderStyle:=bsNone;
    BevelInner:=bvNone;
    BevelOuter:=bvNone;
    BorderWidth:=0;
    ParentBackground:=False;
  end;

  Result.Top:=TPanel.Create(Result.Mid);
  with Result.Top do
  begin
    Parent:=Result.Mid;
    Left:=1;
    Top:=1;
    Width:=hWidth-6;
    Height:=hHeight-6;
    Color:=clBlack;
    BorderStyle:=bsNone;
    BevelInner:=bvNone;
    BevelOuter:=bvNone;
    BorderWidth:=0;
    ParentBackground:=False;
    OnMouseEnter:=@CheckBoxOnEnter;
    OnMouseLeave:=@CheckBoxOnLeave;
    OnMouseDown:=@CheckBoxOnDown;
    OnMouseUp:=@CheckBoxOnUp;
    OnClick:=@CheckBoxOnClick;
  end;

Result.Labl:=TLabel.Create(hParent);
with Result.Labl do
begin
  Parent:=hParent;
  SetBounds((hLeft+hWidth)+5,hTop-2,1000,1000);
  Layout:=tlCenter;
  with Font do
  begin
  Name:='Segoe UI';
  Size:=12;
  Color:=clBlack;
  end;
  OnMouseEnter:=@CheckBoxOnEnter;
  OnMouseLeave:=@CheckBoxOnLeave;
  OnMouseDown:=@CheckBoxOnDown;
  OnMouseUp:=@CheckBoxOnUp;
  Caption:=hText
end;
end;

procedure InitializeWizard;
  begin
  with WizardForm do
  begin
   OuterNotebook.Hide;
   InnerNotebook.Hide;
   Bevel.Hide;
   PageNameLabel.Hide;
   PageDescriptionLabel.Hide;
   MainPanel.Hide;
   BackButton.SetBounds(0,0,0,0);
   NextButton.SetBounds(0,0,0,0);
   CancelButton.SetBounds(0,0,0,0);
   ClientWidth:=900;
   ClientHeight:=540;
   Center;
  end;

  CusChk:=CheckBoxCreate(WizardForm,200,200,20,20,'Exit');
  CheckBoxSetChecked(CusChk,True);
end;
Код:
[Setup]
AppName=MyApp
AppVerName=1.0
DefaultDirName={pf}\MyApp
DefaultGroupName=MyApp
OutputBaseFilename=Setup
OutputDir=Output

[Code]
type
  TCusBtn = record
  Base, Mid, Top: TPanel;
  ModalBtn: TButton;
  end;

var
  CusBtn: TCusBtn;

function CreateRoundRectRgn(p1, p2, p3, p4, p5, p6: Integer): THandle;
  external 'CreateRoundRectRgn@gdi32 stdcall';
function SetWindowRgn(hWnd: HWND; hRgn: LongWord; bRedraw: BOOL): Integer;
  external 'SetWindowRgn@user32.dll stdcall';

procedure ButtonDisabled(Sender: TObject);
  begin
  end;

procedure ButtonEnter(var Button: TCusBtn);
  begin
   Button.Base.Color:=clLime;
   Button.Mid.Color:=clBlack;
   Button.Top.Color:=clLime;
   Button.Top.Font.Color:=clBlack;
  end;

procedure ButtonLeave(var Button: TCusBtn);
  begin
   Button.Base.Color:=clBlack;
   Button.Mid.Color:=clWhite;
   Button.Top.Color:=clBlack;
   Button.Top.Font.Color:=clWhite;
  end;

procedure ButtonDown(var Button: TCusBtn);
  begin
   Button.Base.Color:=clRed;
   Button.Mid.Color:=clWhite;
   Button.Top.Color:=clRed;
   Button.Top.Font.Color:=clWhite;
  end;

procedure ButtonUp(var Button: TCusBtn);
  begin
   Button.Base.Color:=clBlack;
   Button.Mid.Color:=clWhite;
   Button.Top.Color:=clBlack;
   Button.Top.Font.Color:=clWhite;
  end;

procedure ButtonOnEnter(Sender: TObject);
begin
  case Sender of
    CusBtn.Top: ButtonEnter(CusBtn);
  end;
end;

procedure ButtonOnLeave(Sender: TObject);
begin
  case Sender of
    CusBtn.Top: ButtonLeave(CusBtn);
  end;
end;

procedure ButtonOnDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  case Sender of
    CusBtn.Top: ButtonDown(CusBtn);
  end;
end;

procedure ButtonOnUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  case Sender of
    CusBtn.Top: ButtonUp(CusBtn);
  end;
end;

function ButtonGetText(var Button: TCusBtn):String;
begin
  Result:=Button.Top.Caption;
end;

procedure ButtonSetText(var Button: TCusBtn; hText: String);
begin
  Button.Top.Caption:=hText;
end;

procedure ButtonSetVisibility(var Button: TCusBtn; hVisible: Boolean);
begin
  Button.Base.Visible:=hVisible;
end;

procedure ButtonSetEnabled(var Button: TCusBtn; hEnabled: Boolean);
  begin
   Button.Base.Enabled:=hEnabled;
   if hEnabled then
   begin
   Button.Base.Color:=clBlack;
   Button.Mid.Color:=clWhite;
   Button.Top.Color:=clBlack;
   Button.Top.Font.Color:=clWhite;
  end else begin
   Button.Base.Color:=clDkGray;
   Button.Mid.Color:=clLtGray;
   Button.Top.Color:=clDkGray;
   Button.Top.Font.Color:=clLtGray;
  end;
end;

procedure ButtonSetNewPostion(var Button: TCusBtn;  nLeft, nTop : Integer);
begin
  Button.Base.Left:=nLeft;
  Button.Base.Top:=nTop;
end;

procedure ButtonSetEvent(var Button: TCusBtn; Event: TNotifyEvent);
begin
  Button.Top.OnClick:=Event;
end;

procedure ButtonModal(var Button: TCusBtn);
begin
  Button.ModalBtn.Click;
end;

function ButtonCreate(hParent :TWinControl; hLeft, hTop, hWidth, hHeight: Integer; SmallButton: Boolean;Modal: Integer; Fontname : string): TCusBtn;
var
  RE, RE2, RE3 :HWND;
begin
  Result.Base:=TPanel.Create(hParent);
  with Result.Base do
  begin
    Parent:=hParent;
    Left:=hLeft;
    Top:=hTop;
    Width:=hWidth;
    Height:=hHeight;
    Color:=clBlack;
    BorderStyle:=bsNone;
    BevelInner:=bvNone;
    BevelOuter:=bvNone;
    BorderWidth:=0;
    ParentBackground:=False;
  end;

  Result.Mid:=TPanel.Create(Result.Base);
  with Result.Mid do
  begin
    Parent:=Result.Base;
    Left:=2;
    Top:=2;
    Width:=hWidth-4;
    Height:=hHeight-4;
    Color:=clWhite;
    BorderStyle:=bsNone;
    BevelInner:=bvNone;
    BevelOuter:=bvNone;
    BorderWidth:=0;
    ParentBackground:=False;
  end;

  Result.Top:=TPanel.Create(Result.Mid);
  with Result.Top do
  begin
    Parent:=Result.Mid;
    Left:=1;
    Top:=1;
    Width:=hWidth-6;
    Height:=hHeight-6;
    Color:=clBlack;
    BorderStyle:=bsNone;
    BevelInner:=bvNone;
    BevelOuter:=bvNone;
    BorderWidth:=0;
    ParentBackground:=False;
    with Font do
    begin
    Name:='Segoe UI';
    Size:=12;
    Color:=clWhite;
    end;
    OnMouseEnter:=@ButtonOnEnter;
    OnMouseLeave:=@ButtonOnLeave;
    OnMouseDown:=@ButtonOnDown;
    OnMouseUp:=@ButtonOnUp;
  end;

  Result.ModalBtn:=TButton.Create(hParent);
  with Result.ModalBtn do
  begin
    SetBounds(0,0,0,0);
    ModalResult:=Modal;
    Parent:=hParent;
  end;

  RE:=CreateRoundRectRgn(0,0,Result.Base.width,Result.Base.Height+2,4,4);
  RE2:=CreateRoundRectRgn(0,0,Result.Mid.Width,Result.Mid.Height+2,4,4);
  RE3:=CreateRoundRectRgn(0,0,Result.Top.Width,Result.Top.Height+2,4,4);
  SetWindowRgn(Result.Base.Handle,RE,True);
  SetWindowRgn(Result.Mid.Handle,RE2,True);
  SetWindowRgn(Result.Top.Handle,RE3,True);
end;

procedure CusBtnClick(Sender: Tobject);
  begin
    WizardForm.Close;
  end;

procedure InitializeWizard;
  begin
  with WizardForm do
  begin
   OuterNotebook.Hide;
   InnerNotebook.Hide;
   Bevel.Hide;
   PageNameLabel.Hide;
   PageDescriptionLabel.Hide;
   MainPanel.Hide;
   BackButton.SetBounds(0,0,0,0);
   NextButton.SetBounds(0,0,0,0);
   CancelButton.SetBounds(0,0,0,0);
   ClientWidth:=900;
   ClientHeight:=540;
   Center;
  end;

   CusBtn:=ButtonCreate(WizardForm,200,200,100,30,False,mrNone,'Segoe UI');
   ButtonSetText(CusBtn,'Exit');
   ButtonSetEvent(CusBtn,@CusBtnClick);
end;

В: How to customize the toggle button using the panel?
О: Like this.
Base, Mid, Top, Slide : TPanel;
Labl: TLabel;
Untitled 1.jpg
Код:
[Setup]
AppName=MyApp
AppVerName=1.0
DefaultDirName={pf}\MyApp
DefaultGroupName=MyApp
OutputBaseFilename=Setup
OutputDir=Output

[Code]
type
  TCusTogglebtn = record
  Base, Mid, Top, Slide : TPanel;
  Labl: TLabel;
  IsChecked, IsEnabled: Boolean;
  end;

var
  CusTogglebtn: TCusTogglebtn;

procedure ToggleDisabled(var ToggleBtn: TCusTogglebtn);
  begin
  end;

procedure ToggleUp(var ToggleBtn: TCusTogglebtn);
  begin
   if ToggleBtn.IsChecked then
   begin
   ToggleBtn.Slide.Left:=ToggleBtn.Base.Width - ToggleBtn.Slide.Width;
   ToggleBtn.Base.Color:=clLime;
   ToggleBtn.Mid.Color:=clWhite;
   ToggleBtn.Top.Color:=clLime;
   ToggleBtn.Labl.Font.Color:=clLime;
   end else begin
   ToggleBtn.Slide.Left:=0;
   ToggleBtn.Base.Color:=clBlack;
   ToggleBtn.Mid.Color:=clWhite;
   ToggleBtn.Top.Color:=clBlack;
   ToggleBtn.Labl.Font.Color:=clBlack;
  end;
end;

procedure ToggleClick(var ToggleBtn:TCusTogglebtn);
  begin
   ToggleBtn.IsChecked:= not ToggleBtn.IsChecked;
  end;

procedure ToggleOnClick(Sender:TObject);
  begin
   case Sender of
   CusTogglebtn.Top: ToggleClick(CusTogglebtn);
  end;
end;

procedure ToggleOnUp(Sender:TObject; CheckBox:TMouseButton; Shift:TShiftState; X, Y:Integer);
  begin
   case Sender of
   CusTogglebtn.Top: ToggleUp(CusTogglebtn);
  end;
end;

procedure ToggleSetText(var ToggleBtn: TCusTogglebtn; hText: String);
  begin
   ToggleBtn.Top.Caption:=hText;
  end;

procedure ToggleSetVisibility(var ToggleBtn: TCusTogglebtn; hVisible: Boolean);
begin
  ToggleBtn.Base.Visible:=hVisible;
  ToggleBtn.Labl.Visible:=hVisible;
end;

procedure ToggleSetChecked(var ToggleBtn: TCusTogglebtn; hChecked: Boolean);
  begin
   ToggleBtn.IsChecked:=hChecked;
   if ToggleBtn.IsEnabled then
   begin
   if hChecked then
   begin
   ToggleBtn.Slide.Left:=ToggleBtn.Base.Width - ToggleBtn.Slide.Width;
   ToggleBtn.Base.Color:=clLime;
   ToggleBtn.Mid.Color:=clWhite;
   ToggleBtn.Top.Color:=clLime;
   ToggleBtn.Labl.Font.Color:=clLime;
   end else begin
   ToggleBtn.Slide.Left:=0;
   ToggleBtn.Base.Color:=clBlack;
   ToggleBtn.Mid.Color:=clWhite;
   ToggleBtn.Top.Color:=clBlack;
   ToggleBtn.Labl.Font.Color:=clBlack;
  end;
  end else begin
  if hChecked then
  begin
   ToggleBtn.Slide.Left:=ToggleBtn.Base.Width - ToggleBtn.Slide.Width;
   ToggleBtn.Base.Color:=clLime;
   ToggleBtn.Mid.Color:=clWhite;
   ToggleBtn.Top.Color:=clLime;
   ToggleBtn.Labl.Font.Color:=clLime;
   end else begin
   ToggleBtn.Slide.Left:=0;
   ToggleBtn.Base.Color:=clLtGray;
   ToggleBtn.Mid.Color:=clWhite;
   ToggleBtn.Top.Color:=clLtGray;
   ToggleBtn.Labl.Font.Color:=clLtGray;
  end;
end;
end;

function ToggleGetChecked(var ToggleBtn: TCusTogglebtn): Boolean;
begin
  Result:=ToggleBtn.IsChecked;
end;

procedure ToggleSetEvent(var ToggleBtn: TCusTogglebtn; Event: TNotifyEvent);
begin
  if ToggleBtn.IsChecked then
  ToggleBtn.Top.OnClick:=Event;
end;

function ToggleCreate(hParent :TWinControl; hLeft, hTop, hWidth, hHeight: Integer; hText: String): TCusTogglebtn;
  begin
   Result.IsEnabled:=True;
   Result.Base:=TPanel.Create(hParent);
   with Result.Base do
   begin
   Parent:=hParent;
   Left:=hLeft;
   Top:=hTop;
   Width:=hWidth;
   Height:=hHeight;
   Color:=clBlack;
   BorderStyle:=bsNone;
   BevelInner:=bvNone;
   BevelOuter:=bvNone;
   BorderWidth:=0;
   OnMouseUp:=@ToggleOnUp;
   OnClick:=@ToggleOnClick;
   ParentBackground:=False;
  end;

Result.Mid:=TPanel.Create(Result.Base);
with Result.Mid do
  begin
   Parent:=Result.Base;
   Left:=2;
   Top:=2;
   Width:=hWidth-4;
   Height:=hHeight-4;
   Color:=clWhite;
   BorderStyle:=bsNone;
   BevelInner:=bvNone;
   BevelOuter:=bvNone;
   BorderWidth:=0;
   OnMouseUp:=@ToggleOnUp;
   OnClick:=@ToggleOnClick;
   ParentBackground:=False;
  end;

Result.Top:=TPanel.Create(Result.Mid);
with Result.Top do
  begin
   Parent:=Result.Mid;
   Left:=1;
   Top:=1;
   Width:=hWidth-6;
   Height:=hHeight-6;
   Color:=clBlack;
   BorderStyle:=bsNone;
   BevelInner:=bvNone;
   BevelOuter:=bvNone;
   BorderWidth:=0;
   OnMouseUp:=@ToggleOnUp;
   OnClick:=@ToggleOnClick;
   ParentBackground:=False;
  end;

Result.Slide:=TPanel.Create(Result.Base);
with Result.Slide do
  begin
   Parent:=Result.Base;
   Left:=0;
   Top:=0;
   Width:=hWidth-hHeight-10;
   Height:=hHeight;
   Color:=clWhite;
   BorderStyle:=bsNone;
   BevelInner:=bvNone;
   BevelOuter:=bvNone;
   BorderWidth:=0;
   OnMouseUp:=@ToggleOnUp;
   OnClick:=@ToggleOnClick;
   ParentBackground:=False;
  end;

Result.Labl:=TLabel.Create(hParent);
with Result.Labl do
  begin
   Parent:=hParent;
   Transparent:=true;
   SetBounds((hLeft+hWidth)+5,hTop-2,1000,1000);
   with Font do
   begin
   Name:='Segoe UI';
   Size:=12;
   Color:=clBlack;
   end;
   OnMouseUp:=@ToggleOnUp;
   OnClick:=@ToggleOnClick;
   Caption:=hText;
  end;
end;

procedure InitializeWizard;
  begin
  with WizardForm do
  begin
   OuterNotebook.Hide;
   InnerNotebook.Hide;
   Bevel.Hide;
   PageNameLabel.Hide;
   PageDescriptionLabel.Hide;
   MainPanel.Hide;
   BackButton.SetBounds(0,0,0,0);
   NextButton.SetBounds(0,0,0,0);
   CancelButton.SetBounds(0,0,0,0);
   ClientWidth:=900;
   ClientHeight:=540;
   Center;
  end;

  CusTogglebtn:=ToggleCreate(WizardForm,200,200,40,20,'Exit');
  ToggleSetChecked(CusTogglebtn,True);
end;
Код:
[Setup]
AppName=MyApp
AppVerName=1.0
DefaultDirName={pf}\MyApp
DefaultGroupName=MyApp
OutputBaseFilename=Setup
OutputDir=Output

[Code]
type
  TCusTogglebtn = record
  Base, Mid, Top, Slide : TPanel;
  Labl: TLabel;
  IsChecked, IsEnabled: Boolean;
  end;

var
  CusTogglebtn: TCusTogglebtn;

function CreateRoundRectRgn(p1, p2, p3, p4, p5, p6: Integer): THandle;
  external 'CreateRoundRectRgn@gdi32 stdcall';
function SetWindowRgn(hWnd: HWND; hRgn: LongWord; bRedraw: BOOL): Integer;
  external 'SetWindowRgn@user32.dll stdcall';

procedure ToggleDisabled(var ToggleBtn: TCusTogglebtn);
  begin
  end;

procedure ToggleUp(var ToggleBtn: TCusTogglebtn);
  begin
   if ToggleBtn.IsChecked then
   begin
   ToggleBtn.Slide.Left:=ToggleBtn.Base.Width - ToggleBtn.Slide.Width;
   ToggleBtn.Base.Color:=clLime;
   ToggleBtn.Mid.Color:=clWhite;
   ToggleBtn.Top.Color:=clLime;
   ToggleBtn.Labl.Font.Color:=clLime;
   end else begin
   ToggleBtn.Slide.Left:=0;
   ToggleBtn.Base.Color:=clBlack;
   ToggleBtn.Mid.Color:=clWhite;
   ToggleBtn.Top.Color:=clBlack;
   ToggleBtn.Labl.Font.Color:=clBlack;
  end;
end;

procedure ToggleClick(var ToggleBtn:TCusTogglebtn);
  begin
   ToggleBtn.IsChecked:= not ToggleBtn.IsChecked;
  end;

procedure ToggleOnClick(Sender:TObject);
  begin
   case Sender of
   CusTogglebtn.Top: ToggleClick(CusTogglebtn);
  end;
end;

procedure ToggleOnUp(Sender:TObject; CheckBox:TMouseButton; Shift:TShiftState; X, Y:Integer);
  begin
   case Sender of
   CusTogglebtn.Top: ToggleUp(CusTogglebtn);
  end;
end;

procedure ToggleSetText(var ToggleBtn: TCusTogglebtn; hText: String);
  begin
   ToggleBtn.Top.Caption:=hText;
  end;

procedure ToggleSetVisibility(var ToggleBtn: TCusTogglebtn; hVisible: Boolean);
begin
  ToggleBtn.Base.Visible:=hVisible;
  ToggleBtn.Labl.Visible:=hVisible;
end;

procedure ToggleSetChecked(var ToggleBtn: TCusTogglebtn; hChecked: Boolean);
  begin
   ToggleBtn.IsChecked:=hChecked;
   if ToggleBtn.IsEnabled then
   begin
   if hChecked then
   begin
   ToggleBtn.Slide.Left:=ToggleBtn.Base.Width - ToggleBtn.Slide.Width;
   ToggleBtn.Base.Color:=clLime;
   ToggleBtn.Mid.Color:=clWhite;
   ToggleBtn.Top.Color:=clLime;
   ToggleBtn.Labl.Font.Color:=clLime;
   end else begin
   ToggleBtn.Slide.Left:=0;
   ToggleBtn.Base.Color:=clBlack;
   ToggleBtn.Mid.Color:=clWhite;
   ToggleBtn.Top.Color:=clBlack;
   ToggleBtn.Labl.Font.Color:=clBlack;
  end;
  end else begin
  if hChecked then
  begin
   ToggleBtn.Slide.Left:=ToggleBtn.Base.Width - ToggleBtn.Slide.Width;
   ToggleBtn.Base.Color:=clLime;
   ToggleBtn.Mid.Color:=clWhite;
   ToggleBtn.Top.Color:=clLime;
   ToggleBtn.Labl.Font.Color:=clLime;
   end else begin
   ToggleBtn.Slide.Left:=0;
   ToggleBtn.Base.Color:=clLtGray;
   ToggleBtn.Mid.Color:=clWhite;
   ToggleBtn.Top.Color:=clLtGray;
   ToggleBtn.Labl.Font.Color:=clLtGray;
  end;
end;
end;

function ToggleGetChecked(var ToggleBtn: TCusTogglebtn): Boolean;
begin
  Result:=ToggleBtn.IsChecked;
end;

procedure ToggleSetEvent(var ToggleBtn: TCusTogglebtn; Event: TNotifyEvent);
begin
  if ToggleBtn.IsChecked then
  ToggleBtn.Top.OnClick:=Event;
end;

function ToggleCreate(hParent :TWinControl; hLeft, hTop, hWidth, hHeight: Integer; hText: String): TCusTogglebtn;
var
  RE, RE2, RE3, RE4 :HWND;
  begin
   Result.IsEnabled:=True;
   Result.Base:=TPanel.Create(hParent);
   with Result.Base do
   begin
   Parent:=hParent;
   Left:=hLeft;
   Top:=hTop;
   Width:=hWidth;
   Height:=hHeight;
   Color:=clBlack;
   BorderStyle:=bsNone;
   BevelInner:=bvNone;
   BevelOuter:=bvNone;
   BorderWidth:=0;
   OnMouseUp:=@ToggleOnUp;
   OnClick:=@ToggleOnClick;
   ParentBackground:=False;
  end;

Result.Mid:=TPanel.Create(Result.Base);
with Result.Mid do
  begin
   Parent:=Result.Base;
   Left:=2;
   Top:=2;
   Width:=hWidth-4;
   Height:=hHeight-4;
   Color:=clWhite;
   BorderStyle:=bsNone;
   BevelInner:=bvNone;
   BevelOuter:=bvNone;
   BorderWidth:=0;
   OnMouseUp:=@ToggleOnUp;
   OnClick:=@ToggleOnClick;
   ParentBackground:=False;
  end;

Result.Top:=TPanel.Create(Result.Mid);
with Result.Top do
  begin
   Parent:=Result.Mid;
   Left:=1;
   Top:=1;
   Width:=hWidth-6;
   Height:=hHeight-6;
   Color:=clBlack;
   BorderStyle:=bsNone;
   BevelInner:=bvNone;
   BevelOuter:=bvNone;
   BorderWidth:=0;
   OnMouseUp:=@ToggleOnUp;
   OnClick:=@ToggleOnClick;
   ParentBackground:=False;
  end;

Result.Slide:=TPanel.Create(Result.Base);
with Result.Slide do
  begin
   Parent:=Result.Base;
   Left:=0;
   Top:=0;
   Width:=hWidth-hHeight-10;
   Height:=hHeight;
   Color:=clWhite;
   BorderStyle:=bsNone;
   BevelInner:=bvNone;
   BevelOuter:=bvNone;
   BorderWidth:=0;
   OnMouseUp:=@ToggleOnUp;
   OnClick:=@ToggleOnClick;
   ParentBackground:=False;
  end;

Result.Labl:=TLabel.Create(hParent);
with Result.Labl do
  begin
   Parent:=hParent;
   Transparent:=true;
   SetBounds((hLeft+hWidth)+5,hTop-2,1000,1000);
   with Font do
   begin
   Name:='Segoe UI';
   Size:=12;
   Color:=clBlack;
   end;
   OnMouseUp:=@ToggleOnUp;
   OnClick:=@ToggleOnClick;
   Caption:=hText;
  end;

  RE:=CreateRoundRectRgn(0,0,Result.Slide.Width,Result.Slide.Height+2,4,4);
  RE2:=CreateRoundRectRgn(0,0,Result.Base.width,Result.Base.Height+2,4,4);
  RE3:=CreateRoundRectRgn(0,0,Result.Mid.Width,Result.Mid.Height+2,4,4);
  RE4:=CreateRoundRectRgn(0,0,Result.Top.Width,Result.Top.Height+2,4,4);
  SetWindowRgn(Result.Slide.Handle,RE,True);
  SetWindowRgn(Result.Base.Handle,RE2,True);
  SetWindowRgn(Result.Mid.Handle,RE3,True);
  SetWindowRgn(Result.Top.Handle,RE4,True);
end;

procedure InitializeWizard;
  begin
  with WizardForm do
  begin
   OuterNotebook.Hide;
   InnerNotebook.Hide;
   Bevel.Hide;
   PageNameLabel.Hide;
   PageDescriptionLabel.Hide;
   MainPanel.Hide;
   BackButton.SetBounds(0,0,0,0);
   NextButton.SetBounds(0,0,0,0);
   CancelButton.SetBounds(0,0,0,0);
   ClientWidth:=900;
   ClientHeight:=540;
   Center;
  end;

  CusTogglebtn:=ToggleCreate(WizardForm,200,200,40,20,'Exit');
  ToggleSetChecked(CusTogglebtn,True);
end;

В: How to customize the progressbar using the panel?
О: Like this.
Base, Mid, Top: TPanel;
Untitled 1.jpg
Код:
[Setup]
AppName=MyApp
AppVerName=1.0
DefaultDirName={pf}\MyApp
DefaultGroupName=MyApp
OutputBaseFilename=Setup
OutputDir=Output

[Code]
type
  TCusPBR = record
  Base, Mid, Top: TPanel;
  end;

var
  CusPBR: TCusPBR;

function ProgressGetProgress(var Progress: TCusPBr): Extended;
begin
  if Progress.Base.Width <> 0 then
  Result:=(Progress.Top.Width * 100) / (Progress.Base.Width) - 8
  else
  Result:=0;
end;

procedure ProgressSetProgress(var Progress: TCusPBr; hValue: Extended);
begin
  Progress.Top.Width:=Round(((Progress.Base.Width) - 8) * hValue / 100);
end;

procedure ProgressSetVisibility(var Progress: TCusPBr; hVisible: Boolean);
begin
  Progress.Base.Visible:=hVisible;
end;

procedure ProgressSetEvent(var Progress: TCusPBr; Event: TNotifyEvent);
begin
  Progress.Top.OnClick:=Event;
end;

function ProgressCreate(hParent :TWinControl; hLeft, hTop, hWidth, hHeight: Integer): TCusPBr;
begin
  Result.Base:=TPanel.Create(hParent);
  with Result.Base do
  begin
    Parent:=hParent;
    Left:=hLeft;
    Top:=hTop;
    Width:=hWidth;
    Height:=hHeight;
    Color:=clLime;
    BorderStyle:=bsNone;
    BevelInner:=bvNone;
    BevelOuter:=bvNone;
    BorderWidth:=0;
    ParentBackground:=False;
  end;

  Result.Mid:=TPanel.Create(Result.Base);
  with Result.Mid do
  begin
    Parent:=Result.Base;
    Left:=2;
    Top:=2;
    Width:=hWidth-4;
    Height:=hHeight-4;
    Color:=clWhite;
    BorderStyle:=bsNone;
    BevelInner:=bvNone;
    BevelOuter:=bvNone;
    BorderWidth:=0;
    ParentBackground:=False;
  end;

  Result.Top:=TPanel.Create(Result.Mid);
  with Result.Top do
  begin
    Parent:=Result.Mid;
    Left:=2;
    Top:=2;
    Width:=hWidth-8;
    Height:=hHeight-8;
    Color:=clLime;
    BorderStyle:=bsNone;
    BevelInner:=bvNone;
    BevelOuter:=bvNone;
    BorderWidth:=0;
    ParentBackground:=False;
  end;
end;

procedure InitializeWizard;
  begin
  with WizardForm do
  begin
   OuterNotebook.Hide;
   InnerNotebook.Hide;
   Bevel.Hide;
   PageNameLabel.Hide;
   PageDescriptionLabel.Hide;
   MainPanel.Hide;
   BackButton.SetBounds(0,0,0,0);
   NextButton.SetBounds(0,0,0,0);
   CancelButton.SetBounds(0,0,0,0);
   ClientWidth:=900;
   ClientHeight:=540;
   Center;
  end;

  CusPBR:=ProgressCreate(WizardForm,200,200,600,30);
  ProgressSetProgress(CusPBR,100);
end;
Код:
[Setup]
AppName=MyApp
AppVerName=1.0
DefaultDirName={pf}\MyApp
DefaultGroupName=MyApp
OutputBaseFilename=Setup
OutputDir=Output

[Code]
type
  TCusPBR = record
  Base, Mid, Top: TPanel;
  end;

var
  CusPBR: TCusPBR;

function CreateRoundRectRgn(p1, p2, p3, p4, p5, p6: Integer): THandle;
  external 'CreateRoundRectRgn@gdi32 stdcall';
function SetWindowRgn(hWnd: HWND; hRgn: LongWord; bRedraw: BOOL): Integer;
  external 'SetWindowRgn@user32.dll stdcall';

function ProgressGetProgress(var Progress: TCusPBr): Extended;
begin
  if Progress.Base.Width <> 0 then
  Result:=(Progress.Top.Width * 100) / (Progress.Base.Width) - 8
  else
  Result:=0;
end;

procedure ProgressSetProgress(var Progress: TCusPBr; hValue: Extended);
begin
  Progress.Top.Width:=Round(((Progress.Base.Width) - 8) * hValue / 100);
end;

procedure ProgressSetVisibility(var Progress: TCusPBr; hVisible: Boolean);
begin
  Progress.Base.Visible:=hVisible;
end;

procedure ProgressSetEvent(var Progress: TCusPBr; Event: TNotifyEvent);
begin
  Progress.Top.OnClick:=Event;
end;

function ProgressCreate(hParent :TWinControl; hLeft, hTop, hWidth, hHeight: Integer): TCusPBr;
var
  RE, RE2, RE3 :HWND;
begin
  Result.Base:=TPanel.Create(hParent);
  with Result.Base do
  begin
    Parent:=hParent;
    Left:=hLeft;
    Top:=hTop;
    Width:=hWidth;
    Height:=hHeight;
    Color:=clLime;
    BorderStyle:=bsNone;
    BevelInner:=bvNone;
    BevelOuter:=bvNone;
    BorderWidth:=0;
    ParentBackground:=False;
  end;

  Result.Mid:=TPanel.Create(Result.Base);
  with Result.Mid do
  begin
    Parent:=Result.Base;
    Left:=2;
    Top:=2;
    Width:=hWidth-4;
    Height:=hHeight-4;
    Color:=clWhite;
    BorderStyle:=bsNone;
    BevelInner:=bvNone;
    BevelOuter:=bvNone;
    BorderWidth:=0;
    ParentBackground:=False;
  end;

  Result.Top:=TPanel.Create(Result.Mid);
  with Result.Top do
  begin
    Parent:=Result.Mid;
    Left:=2;
    Top:=2;
    Width:=hWidth-8;
    Height:=hHeight-8;
    Color:=clLime;
    BorderStyle:=bsNone;
    BevelInner:=bvNone;
    BevelOuter:=bvNone;
    BorderWidth:=0;
    ParentBackground:=False;
  end;

  RE:=CreateRoundRectRgn(0,0,Result.Base.width,Result.Base.Height+2,4,4);
  RE2:=CreateRoundRectRgn(0,0,Result.Mid.Width,Result.Mid.Height+2,4,4);
  RE3:=CreateRoundRectRgn(0,0,Result.Top.Width,Result.Top.Height+2,4,4);
  SetWindowRgn(Result.Base.Handle,RE,True);
  SetWindowRgn(Result.Mid.Handle,RE2,True);
  SetWindowRgn(Result.Top.Handle,RE3,True);
end;

procedure InitializeWizard;
  begin
  with WizardForm do
  begin
   OuterNotebook.Hide;
   InnerNotebook.Hide;
   Bevel.Hide;
   PageNameLabel.Hide;
   PageDescriptionLabel.Hide;
   MainPanel.Hide;
   BackButton.SetBounds(0,0,0,0);
   NextButton.SetBounds(0,0,0,0);
   CancelButton.SetBounds(0,0,0,0);
   ClientWidth:=900;
   ClientHeight:=540;
   Center;
  end;

  CusPBR:=ProgressCreate(WizardForm,200,200,600,30);
  ProgressSetProgress(CusPBR,100);
end;

В: How to customize the date and time?
О: Like this.
LTime, LDate: TLabel;
LTimer: TTimer;
Untitled 1.jpg
Код:
[Setup]
AppName=MyApp
AppVerName=1.0
DefaultDirName={pf}\MyApp
DefaultGroupName=MyApp
OutputBaseFilename=Setup
OutputDir=Output

[Code]
var
  LTime, LDate: TLabel;
  LTimer: TTimer;

function Time:String;
var
  Hour, Min, Sec, MSec: Word;
  HR, MN, HC: String;
begin
  DecodeTime(Now,Hour,Min,Sec,MSec);
  if Hour < 12 then
  begin
    HC:='AM'
    HR:=IntToStr(Hour);
  end;
  if Hour = 12 then
  begin
    HC:='PM';
    HR:='12';
  end;
  if Hour > 12 then
  begin
    HC:='PM';
    HR:=IntToStr(Hour - 12);
  end;
  if Hour = 0 then
  begin
    HC:='AM';
    HR:='12';
  end;
  if (Min < 10) then
    MN:='0' + IntToStr(Min)
  else
    MN:=IntToStr(Min);
  Result:=HR + ':' + MN + ' ' + HC;
end;

function Date:String;
var
  Year, Month, Day: Word;
  WD, MT: String;
begin
  DecodeDate(Now,Year,Month,Day);
  case DayOfWeek(Now) of
    1: WD:='Sunday';
    2: WD:='Monday';
    3: WD:='Tuesday';
    4: WD:='Wednesday';
    5: WD:='Thursday';
    6: WD:='Friday';
    7: WD:='Saturday';
  end;
  case Month of
    1: MT:='January';
    2: MT:='February';
    3: MT:='March';
    4: MT:='April';
    5: MT:='May';
    6: MT:='June';
    7: MT:='July';
    8: MT:='August';
    9: MT:='September';
    10: MT:='October';
    11: MT:='November';
    12: MT:='December';
  end;
Result:= WD + ' ' + IntToStr(Day) + ' ' + MT + ' ' + IntToStr(Year);
end;

procedure OnTimer(Sender: TObject);
begin
  LTime.Caption:=Time;
  LDate.Caption:=Date;
end;

procedure InitializeWizard;
  begin
  with WizardForm do
  begin
   OuterNotebook.Hide;
   InnerNotebook.Hide;
   Bevel.Hide;
   PageNameLabel.Hide;
   PageDescriptionLabel.Hide;
   MainPanel.Hide;
   BackButton.SetBounds(0,0,0,0);
   NextButton.SetBounds(0,0,0,0);
   CancelButton.SetBounds(0,0,0,0);
   ClientWidth:=900;
   ClientHeight:=540;
   Center;
  end;

  LTime:=TLabel.Create(WizardForm);
  with LTime do
  begin
    Parent:=WizardForm;
    SetBounds(200,200,0,0);
    with Font do
    begin
      Name:='Segoe UI';
      Size:=20;
      Color:=clBlack;
    end;
    Caption:=Time;
  end;

  LDate:=TLabel.Create(WizardForm);
  with LDate do
  begin
    Parent:=WizardForm;
    SetBounds(200,250,0,0);
    with Font do
    begin
      Name:='Segoe UI';
      Size:=20;
      Color:=clBlack;
    end;
    Caption:=Date;
  end;

  LTimer:=TTimer.Create(WizardForm);
  with LTimer do
  begin
    OnTimer:=@OnTimer;
    Interval:=1;
    Enabled:=True;
  end;
end;

В: How to customize the diredit and groupedit using the panel?
О: Like this.
Base, Top: TPanel;
Untitled 1.jpg
Код:
[Setup]
AppName=MyApp
AppVerName=1.0
DefaultDirName={pf}\MyApp
DefaultGroupName=MyApp
OutputBaseFilename=Setup
OutputDir=Output

[Code]
type
  TCusEdt = record
  Base, Top: TPanel;
  end;

var
  CusEdt, CusGrp: TCusEdt;

function EditGetText(var Edit: TCusEdt):String;
begin
  Result:=Edit.Top.Caption;
end;

procedure EditSetText(var Edit: TCusEdt; hText: String);
begin
  Edit.Top.Caption:=hText;
end;

procedure EditSetVisibility(var Edit: TCusEdt; hVisible: Boolean);
begin
  Edit.Base.Visible:=hVisible;
end;

procedure EditSetEvent(var Edit: TCusEdt; Event: TNotifyEvent);
begin
  Edit.Top.OnClick:=Event;
end;

function EditCreate(hParent :TWinControl; hLeft, hTop, hWidth, hHeight: Integer): TCusEdt;
begin
  Result.Base:=TPanel.Create(hParent);
  with Result.Base do
  begin
    Parent:=hParent;
    Left:=hLeft;
    Top:=hTop;
    Width:=hWidth;
    Height:=hHeight;
    Color:=clLime;
    BorderStyle:=bsNone;
    BevelInner:=bvNone;
    BevelOuter:=bvNone;
    BorderWidth:=0;
    ParentBackground:=False;
  end;

  Result.Top:=TPanel.Create(Result.Base);
  with Result.Top do
  begin
    Parent:=Result.Base;
    Alignment:=taLeftJustify;
    Left:=1;
    Top:=1;
    Width:=hWidth-2;
    Height:=hHeight-2;
    BorderStyle:=bsNone;
    BevelInner:=bvNone;
    BevelOuter:=bvNone;
    BorderWidth:=0;
    Color:=clWhite;
    ParentBackground:=False;
    with Font do
    begin
      Name:='Segoe UI';
      Size:=12;
      Color:=clBlack;
    end;
  end;
end;

procedure InitializeWizard;
  begin
  with WizardForm do
  begin
   OuterNotebook.Hide;
   InnerNotebook.Hide;
   Bevel.Hide;
   PageNameLabel.Hide;
   PageDescriptionLabel.Hide;
   MainPanel.Hide;
   BackButton.SetBounds(0,0,0,0);
   NextButton.SetBounds(0,0,0,0);
   CancelButton.SetBounds(0,0,0,0);
   ClientWidth:=900;
   ClientHeight:=540;
   Center;
  end;

  CusEdt:=EditCreate(WizardForm,200,200,600,30);
  EditSetText(CusEdt,'  '+MinimizePathName(WizardForm.DirEdit.Text,CusEdt.Top.Font,CusEdt.Top.Width));

  CusGrp:=EditCreate(WizardForm,200,250,600,30);
  EditSetText(CusGrp,'  '+MinimizePathName(WizardForm.GroupEdit.Text,CusGrp.Top.Font,CusGrp.Top.Width))
end;

В: How to customize the dirbevel and groupbevel using the panel?
О: Like this.
LB, TB, RB, BB: TPanel;
Labl: TLabel;
Untitled 1.jpg
Код:
[Setup]
AppName=MyApp
AppVerName=1.0
DefaultDirName={pf}\MyApp
DefaultGroupName=MyApp
OutputBaseFilename=Setup
OutputDir=Output

[Code]
type
  TCusBevel = record
  LB, TB, RB, BB: TPanel;
  Labl: TLabel;
  end;

var
  CusEdt, CusGrp: TCusBevel;

procedure Bevel1SetVisibility(var Bevel1: TCusBevel; hVisible: Boolean);
begin
  Bevel1.LB.Visible:=hVisible;
  Bevel1.TB.Visible:=hVisible;
  Bevel1.RB.Visible:=hVisible;
  Bevel1.BB.Visible:=hVisible;
  Bevel1.Labl.Visible:=hVisible;
end;

function BevelCreate(hParent: TWinControl; hLeft, hTop, hWidth, hHeight: Integer; hText: String): TCusBevel;
begin
  Result.Labl:=TLabel.Create(hParent);
  with Result.Labl do
  begin
  Parent:=hParent;
  SetBounds(hLeft+7,hTop+3, hWidth-10, hHeight-7);
  Layout:=tlTop;
    with Font do
    begin
      Name:='Segoe UI';
      Size:=12;
      Color:=clBlack;
    end;
  Caption:=hText;
end;

  Result.LB:=TPanel.Create(hParent);
  with Result.LB do
  begin
    Parent:=hParent;
    Alignment:=taLeftJustify;
    Left:=hLeft;
    Top:=hTop;
    Width:=2;
    Height:=Result.Labl.Height+7;
    Color:=clLime;
    BorderStyle:=bsNone;
    BevelInner:=bvNone;
    BevelOuter:=bvNone;
    BorderWidth:=0;
    ParentBackground:=False;
  end;

  Result.TB:=TPanel.Create(hParent);
  with Result.TB do
  begin
    Parent:=hParent;
    Alignment:=taLeftJustify;
    Left:=hLeft;
    Top:=hTop;
    Width:=hWidth;
    Height:=2;
    Color:=clLime;
    BorderStyle:=bsNone;
    BevelInner:=bvNone;
    BevelOuter:=bvNone;
    BorderWidth:=0;
    ParentBackground:=False;
  end;

  Result.RB:=TPanel.Create(hParent);
  with Result.RB do
  begin
    Parent:=hParent;
    Alignment:=taLeftJustify;
    Left:=hLeft+hWidth-2;
    Top:=hTop;
    Width:=2;
    Height:=Result.Labl.Height+7;
    Color:=clLime;
    BorderStyle:=bsNone;
    BevelInner:=bvNone;
    BevelOuter:=bvNone;
    BorderWidth:=0;
    ParentBackground:=False;
  end;

  Result.BB:=TPanel.Create(hParent);
  with Result.BB do
  begin
    Parent:=hParent;
    Alignment:=taLeftJustify;
    Left:=hLeft;
    Top:=hTop+Result.TB.Height+Result.Labl.Height+3;
    Width:=hWidth;
    Height:=2;
    Color:=clLime;
    BorderStyle:=bsNone;
    BevelInner:=bvNone;
    BevelOuter:=bvNone;
    BorderWidth:=0;
    ParentBackground:=False;
  end;
end;

procedure InitializeWizard;
  begin
  with WizardForm do
  begin
   OuterNotebook.Hide;
   InnerNotebook.Hide;
   Bevel.Hide;
   PageNameLabel.Hide;
   PageDescriptionLabel.Hide;
   MainPanel.Hide;
   BackButton.SetBounds(0,0,0,0);
   NextButton.SetBounds(0,0,0,0);
   CancelButton.SetBounds(0,0,0,0);
   ClientWidth:=900;
   ClientHeight:=540;
   Center;
  end;

  CusEdt:=BevelCreate(WizardForm,200,200,600,30,' '+WizardForm.DirEdit.Text);

  CusGrp:=BevelCreate(WizardForm,200,250,600,30,' '+WizardForm.GroupEdit.Text);
end;
 
Последнее редактирование:

Yaroslav950

Участник
В: Как проверить на наличие ключа в реестре?
О: Так:
[Setup]
AppName=My Application
AppVersion=1.5
DefaultDirName={pf}\My Application

Код:
function IsRegistryKeyExists(const RootKey: Integer; const SubKey: String): Boolean;
var
  Value: String;
begin
  // Пытаемся получить строковое значение из реестра
  Result := RegQueryStringValue(RootKey, SubKey, '', Value);
end;

// Пример использования
function InitializeSetup(): Boolean;
begin
  // Проверяем наличие ключа в реестре
  if IsRegistryKeyExists(HKEY_LOCAL_MACHINE, 'Software\YourCompany\YourProduct') then
  begin
    // Ключ существует, делаем что-то...
    MsgBox('Ключ найден!', mbInformation, MB_OK);
  end
  else
  begin
    // Ключ не существует, делаем что-то еще...
    MsgBox('Ключ не найден!', mbInformation, MB_OK);
  end;

  // Всегда возвращаем True, чтобы установка продолжилась
  Result := True;
end;
[/SPOILER]
 

Yaroslav950

Участник
В: Как разрешить установщику перекидывать DLL в системную папку windows ?
О: Так:
[Setup]
AppName=My Application
AppVersion=1.5
DefaultDirName={pf}\My Application
PrivilegesRequired=admin - ваш установщик становится администратором и выполняет любые команды без разрешения самого пользователя

[Files]
Source: MPG4C32.dll ; DestDir: {win}\System32 ; Flags: ignoreversion // внимательно изучите константы {win} {sys} и прочее, ну допустим мы хотим перенести Dll в папку system32, а мы вместо {win} написали {sys},то создается папка в самой system32,а нам надо в эту папку кинуть, так что правильным будет win.
 
Сверху