Ветеран
Сообщения: 1133
Благодарности: 581
|
Профиль
|
Отправить PM
| Цитировать
пример:
читать дальше »
Код: ![Выделить весь код](images/misc/selectcode.png)
[Setup]
AppName=My Program
AppVerName=My Program v 1.5
DefaultDirName={pf}\My Program
OutputDir=.
[Files]
Source: compiler:Examples\MyProg.exe; DestDir: {app}
Code]
var
WelcomeLabel1,WelcomeLabel2,FinishedHeadingLabel,RunLabel,
FinishedLabel,PageNameLabel,PageDescriptionLabel:TLabel;
RunMyProg: TCheckBox;
// процедура для запуска программы если отмечен чебокс
procedure CurStepChanged(CurStep: TSetupStep);
var
ErrorCode: Integer;
begin
if CurStep = ssDone then
begin
if RunMyProg.Checked then
Exec(ExpandConstant('{app}\MyProg.exe'), '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);
end;
end;
procedure InitializeWizard();
begin
WizardForm.WelcomeLabel1.Hide;
WizardForm.WelcomeLabel2.Hide;
WizardForm.PageNameLabel.Hide;
WizardForm.PageDescriptionLabel.Hide;
WizardForm.FinishedHeadingLabel.Hide;
WizardForm.FinishedLabel.Hide;
// низнаю почему, но Hide не действует. Поэтому просто уменьшил размер
WizardForm.RunList.Height := 0;
WizardForm.RunList.Width := 0;
WizardForm.WizardBitmapImage.Align:=true;
WizardForm.WizardBitmapImage2.Align:=true;
WizardForm.WizardSmallBitmapImage.Align:=true;
WelcomeLabel1:=TLabel.Create(WizardForm);
WelcomeLabel1.Left:=ScaleX(150);
WelcomeLabel1.Top := ScaleY(15);
WelcomeLabel1.Width := ScaleX(320);
WelcomeLabel1.Height := ScaleY(75);
WelcomeLabel1.AutoSize := False;
WelcomeLabel1.WordWrap := True;
WelcomeLabel1.Font.Color := clBlack;
// здесь можно поиграть шрифтом
// WelcomeLabel1.Font.Style := [fsBold];
// WelcomeLabel1.Font.Name:='MS Sans Serif';
WelcomeLabel1.Font.Size := 14;
WelcomeLabel1.Transparent := True;
WelcomeLabel1.Parent := WizardForm.WelcomePage;
WelcomeLabel2:=TLabel.Create(WizardForm);
WelcomeLabel2.Left := ScaleX(150);
WelcomeLabel2.Top := ScaleY(90);
WelcomeLabel2.Width := ScaleX(320);
WelcomeLabel2.Height := ScaleY(200);
WelcomeLabel2.AutoSize := False;
WelcomeLabel2.WordWrap := True;
WelcomeLabel2.Font.Color := clBlack;
WelcomeLabel2.Font.Size := 8;
WelcomeLabel2.Transparent := True;
WelcomeLabel2.Parent := WizardForm.WelcomePage;
PageNameLabel := TLabel.Create(WizardForm);
PageNameLabel.Left := ScaleX(25);
PageNameLabel.Top := ScaleY(10);
PageNameLabel.Width := ScaleX(300);
PageNameLabel.Height := ScaleY(14);
PageNameLabel.AutoSize := False;
PageNameLabel.WordWrap := True;
PageNameLabel.Font.Color := clBlack;
PageNameLabel.Font.Style := [fsBold];
PageNameLabel.Transparent := True;
PageNameLabel.Parent := WizardForm.MainPanel;
PageDescriptionLabel := TLabel.Create(WizardForm);
PageDescriptionLabel.Left := ScaleX(40);
PageDescriptionLabel.Top := ScaleY(25);
PageDescriptionLabel.Width := ScaleX(475);
PageDescriptionLabel.Height := ScaleY(30);
PageDescriptionLabel.AutoSize := False;
PageDescriptionLabel.WordWrap := True;
PageDescriptionLabel.Font.Color := clBlack;
PageDescriptionLabel.Transparent := True;
PageDescriptionLabel.Parent := WizardForm.MainPanel;
FinishedHeadingLabel:=TLabel.Create(WizardForm);
FinishedHeadingLabel.Left := ScaleX(150);
FinishedHeadingLabel.Top := ScaleY(15);
FinishedHeadingLabel.Width := ScaleX(320);
FinishedHeadingLabel.Height := ScaleY(75);
FinishedHeadingLabel.AutoSize := False;
FinishedHeadingLabel.WordWrap := True;
FinishedHeadingLabel.Font.Color := clBlack;
// здесь тоже можно поиграть шрифтом
// FinishedHeadingLabel.Font.Style := [fsBold];
// FinishedHeadingLabel.Font.Name:='MS Sans Serif';
FinishedHeadingLabel.Font.Size := 14;
FinishedHeadingLabel.Transparent := True;
FinishedHeadingLabel.Parent := WizardForm.FinishedPage;
FinishedLabel:=TLabel.Create(WizardForm);
FinishedLabel.Left := ScaleX(150);
FinishedLabel.Top := ScaleY(90);
FinishedLabel.Width := ScaleX(320);
FinishedLabel.Height := ScaleY(200);
FinishedLabel.AutoSize := False;
FinishedLabel.WordWrap := True;
FinishedLabel.Font.Color := clBlack;
FinishedLabel.Font.Size := 8;
FinishedLabel.Transparent := True;
FinishedLabel.Parent := WizardForm.FinishedPage;
RunMyProg := TCheckBox.Create(WizardForm);
RunMyProg.Parent := WizardForm.FinishedPage;
RunMyProg.Left := ScaleX(150);
RunMyProg.Top := ScaleY(152);
RunMyProg.Width := ScaleX(14);
RunMyProg.Height := ScaleX(14);
// RunMyProg.Checked := true; // чтоб чебокс был отмечен, раскоментируй строку
RunLabel:=TLabel.Create(WizardForm);
RunLabel.Left := ScaleX(170);
RunLabel.Top := ScaleY(150);
RunLabel.Width := ScaleX(200);
RunLabel.Height := ScaleY(20);
RunLabel.AutoSize := False;
RunLabel.WordWrap := True;
RunLabel.Font.Color := clBlack;
RunLabel.Font.Size := 10;
RunLabel.Transparent := True;
RunLabel.Parent := WizardForm.FinishedPage;
end;
procedure CurPageChanged(CurPageID: Integer);
begin
WelcomeLabel1.Caption := WizardForm.WelcomeLabel1.Caption;
WelcomeLabel2.Caption := WizardForm.WelcomeLabel2.Caption;
PageNameLabel.Caption := WizardForm.PageNameLabel.Caption;
PageDescriptionLabel.Caption := WizardForm.PageDescriptionLabel.Caption;
FinishedHeadingLabel.Caption := WizardForm.FinishedHeadingLabel.Caption;
FinishedLabel.Caption := WizardForm.FinishedLabel.Caption;
// здесь придётся вручную вводить требуемый текст
RunLabel.Caption := 'Запустить программу';
end;
|
-------
Книги нужны, чтобы напоминать человеку, что его оригинальные мысли не так уж новы... Авраам Линкольн.
Отправлено: 22:42, 20-02-2009
| #458
|