STRATEG1992
Junior Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору [Code] var DirectX, Redist: TCheckBox; Icons, Group: TCheckBox; lblDirectX, lblSelectDir, lblSelectDirBrowse, lblRedist: TLabel; lblIcons, lblGroup: TLabel; PageNameLabel, PageDescriptionLabel: TLabel; PageNameLabel1, PageDescriptionLabel1: TLabel; StatusLabel: TLabel; WelcomeLabel1, WelcomeLabel2, FinishedLabel, FinishedHeadingLabel: TLabel; NeedSize:Integer; FreeMB, TotalMB: Cardinal; NeedSpaceLabel,FreeSpaceLabel: TLabel; BmpFile: TBitmapImage; function InstallDirectX: Boolean; begin Result:= DirectX.Checked; end; function InstallRedist: Boolean; begin Result:=Redist.Checked; end; function CreateIcons: Boolean; begin Result:=Icons.Checked; end; function GroupIcons: Boolean; begin Result:=Group.Checked; end; // задал процедуру, чтоб отмечался чебокс еси кликнуть по надписи lblCheckBox procedure RedistOnClick(Sender: TObject); begin if Redist.Checked = False then Redist.Checked:= True else Redist.Checked:= False; end; procedure lblDirectXOnClick(Sender: TObject); begin if DirectX.Checked = False then DirectX.Checked:= True else DirectX.Checked:= False; end; procedure IconsOnClick(Sender: TObject); begin if Icons.Checked = False then Icons.Checked:= True else Icons.Checked:= False; end; procedure GroupOnClick(Sender: TObject); begin if Group.Checked = False then Group.Checked:= True else Group.Checked:= False; end; // задал процедуру, чтоб отмечался чебокс еси кликнуть по надписи lblCheckBox //Свободное место procedure GetFreeSpaceCaption(Sender: TObject); var Path: String; begin Path := ExtractFileDrive(WizardForm.DirEdit.Text); GetSpaceOnDisk(Path, True, FreeMB, TotalMB); if FreeMB > 1024 then FreeSpaceLabel.Caption := ExpandConstant('{cm:SPACE} ')+ FloatToStr(round(FreeMB/1024*100)/100) + ' GB' else FreeSpaceLabel.Caption := ExpandConstant('{cm:SPACE} ')+ IntToStr(FreeMB)+ ' MB'; if FreeMB < NeedSize then WizardForm.NextButton.Enabled := False else WizardForm.NextButton.Enabled := True; end; procedure GetNeedSpaceCaption; begin if NeedSize > 1024 then NeedSpaceLabel.Caption := ExpandConstant('{cm:SPACE1} ')+ FloatToStr(round(NeedSize/1024*100)/100) + ' GB' else NeedSpaceLabel.Caption := ExpandConstant('{cm:SPACE1} ')+ IntToStr(NeedSize)+ ' MB'; end; //Свободное место procedure ExtLog(); begin SaveStringToFile(ExpandConstant('{app}\setup.log'), #13#10 + GetDateTimeString('dd/mm/yyyy hh:nn:ss', '-', ':') + ' - ' + ExpandConstant(CurrentFileName), True); with WizardForm.ProgressGauge do StatusLabel.Caption:= 'Рапаковка файлов. Выполнено ' + + IntToStr((Position-Min)/((Max - Min)/100)) + '%'; end; //Загрузка скина procedure LoadSkin(lpszPath: String; lpszIniFileName: String); external 'LoadSkin@files:isskin.dll stdcall'; procedure UnloadSkin(); external 'UnloadSkin@files:isskin.dll stdcall'; function ShowWindow(hWnd: Integer; uType: Integer): Integer; external 'ShowWindow@user32.dll stdcall'; function InitializeSetup(): Boolean; begin ExtractTemporaryFile('Vista.cjstyles'); LoadSkin(ExpandConstant('{tmp}\Vista.cjstyles'), ''); Result := True; end; procedure DeinitializeSetup(); begin ShowWindow(StrToInt(ExpandConstant('{wizardhwnd}')), 0); UnloadSkin(); end; //Загрузка скина procedure InitializeWizard(); begin ExtractTemporaryFile('1.bmp'); NeedSize:= 7970; BmpFile:= TBitmapImage.Create(WizardForm); BmpFile.Bitmap.LoadFromFile(ExpandConstant('{tmp}\1.bmp')); BmpFile.SetBounds(0, 0, 497, 360); BmpFile.Stretch:= true BmpFile.Parent:= WizardForm.WelcomePage; BmpFile:= TBitmapImage.Create(WizardForm); BmpFile.Bitmap.LoadFromFile(ExpandConstant('{tmp}\1.bmp')); BmpFile.SetBounds(0, 0, 497, 360); BmpFile.Stretch:= true BmpFile.Parent:= WizardForm.LicensePage; BmpFile:= TBitmapImage.Create(WizardForm); BmpFile.Bitmap.LoadFromFile(ExpandConstant('{tmp}\1.bmp')); BmpFile.SetBounds(0, 0, 497, 360); BmpFile.Stretch:= true BmpFile.Parent:= WizardForm.SelectDirPage; BmpFile:= TBitmapImage.Create(WizardForm); BmpFile.Bitmap.LoadFromFile(ExpandConstant('{tmp}\1.bmp')); BmpFile.SetBounds(0, 0, 497, 360); BmpFile.Stretch:= true BmpFile.Parent:= WizardForm.InstallingPage; BmpFile:= TBitmapImage.Create(WizardForm); BmpFile.Bitmap.LoadFromFile(ExpandConstant('{tmp}\1.bmp')); BmpFile.SetBounds(0, 0, 497, 360); BmpFile.Stretch:= true BmpFile.Parent:= WizardForm.FinishedPage; BmpFile:= TBitmapImage.Create(WizardForm); with WizardForm do begin PageNameLabel.Hide; PageDescriptionLabel.Hide; WelcomeLabel1.Hide; WelcomeLabel2.Hide; DiskSpaceLabel.Hide; SelectDirBitmapImage.Hide; SelectDirBrowseLabel.Hide; SelectDirLabel.Hide; FinishedHeadingLabel.Hide; FinishedLabel.Hide; MainPanel.Hide FilenameLabel.Hide; StatusLabel.Hide; end; with WizardForm do begin DirBrowseButton.Left:= DirBrowseButton.Left + ScaleX(40); DirBrowseButton.Top:= DirBrowseButton.Top + ScaleY(72); DirEdit.Left:= DirEdit.Left + ScaleX(40); DirEdit.Top:= DirEdit.Top + ScaleY(72); NextButton.BringToFront; BackButton.BringToFront; CancelButton.BringToFront; Font.Style:=[]; Font.Name:= 'MS Sans Serif'; DirEdit.Color:=clBlack; Font.Color:=clWhite; ProgressGauge.Top:=ScaleY(120); ProgressGauge.Left:=ScaleX(20); end; with WizardForm do begin InnerNotebook.Left := ScaleX(0); InnerNotebook.Top := ScaleY(0); InnerNotebook.Width := ScaleX(497); InnerNotebook.Height := ScaleY(360); OuterNotebook.Left := ScaleX(0); OuterNotebook.Top := ScaleY(0); OuterNotebook.Width := ScaleX(497); OuterNotebook.Height := ScaleY(360); end; WelcomeLabel1:= TLabel.Create(WizardForm); with WelcomeLabel1 do begin Left:= ScaleX(176); Top:= ScaleY(66); Width:= ScaleX(301); Height:= ScaleY(54); AutoSize:= false; Transparent:= true; WordWrap:= true; Font.Size:= 14; Font.Color:=ClWhite Font.Style := [fsBold] Parent:= WizardForm.WelcomePage; Caption:= WizardForm.WelcomeLabel1.Caption; //'Вас приветствует Мастер' + #10 + 'установки Prototype' end; WelcomeLabel2:=TLabel.Create(WizardForm); with WelcomeLabel2 do begin Top:= ScaleY(136); Left:= ScaleX(176); Width:= ScaleX(301); Height:= ScaleY(300); AutoSize:= false; WordWrap:= true; Transparent:= true; Parent:= WizardForm.WelcomePage; Caption:= WizardForm.WelcomeLabel2.Caption; //'Программа установит Prototype на Ваш компьютер.' + #10#13#10 + 'Рекомендуется закрыть все прочие приложения перед' + #10 + 'тем, как продолжить.' + #10#13#10 + 'Нажмите «Далее», чтобы продолжить или «Отмена»,' + #10 + 'чтобы выйти из прошраммы установки.'; end; FinishedHeadingLabel:=TLabel.Create(WizardForm); with FinishedHeadingLabel do begin Top:= ScaleY(66); Left:= ScaleX(176); Width:= ScaleX(301); Height:= ScaleY(53); AutoSize:= false; WordWrap:= true; Font.Size:= 14; Font.Color:=ClWhite Font.Style := [fsBold] Transparent:= true; Parent:= WizardForm.FinishedPage; Caption:= WizardForm.FinishedHeadingLabel.Caption; //'Завершение Мастера установки' + #10 + 'Prototype' end; FinishedLabel:= TLabel.Create(WizardForm); with FinishedLabel do begin Left:= ScaleX(176); Top:= ScaleY(136); Width:= ScaleX(301); Height:= ScaleY(54); AutoSize:= false; WordWrap:= true; Transparent:= true; Parent:= WizardForm.FinishedPage; Caption:= 'Игра Prototype установлена на Ваш компьютер.' + #10#13#10 + 'Нажмите «Завершить», чтобы выйти из программы' + #10 + 'установки.' end; // уменьшил размер CheckBox'а, по другому никак DirectX:= TCheckBox.Create(WizardForm); with DirectX do begin Parent:= WizardForm.SelectDirPage; Left:= WizardForm.DirEdit.Left + 200; Top:= WizardForm.DirEdit.Top + 35; Width:= ScaleX(14); Height:= ScaleY(14); TabOrder:= 0; Checked:= False; end; // создаём надпись для CheckBox'а lblDirectX:= TLabel.Create(WizardForm); with lblDirectX do begin Caption:= ExpandConstant('{cm:DRT}'); Left:= WizardForm.DirEdit.Left + 220; Top:= WizardForm.DirEdit.Top + 35; Width:= ScaleX(150); Height:= ScaleY(13); Transparent := True; Parent:= WizardForm.SelectDirPage; OnClick:= @lblDirectXOnClick; end; Redist:= TCheckBox.Create(WizardForm); with Redist do begin Parent:= WizardForm.SelectDirPage; Left:= WizardForm.DirEdit.Left + 200; Top:= WizardForm.DirEdit.Top + 70; Width:= ScaleX(14); Height:= ScaleY(14); TabOrder:= 1; Checked:= False; end; lblRedist:= TLabel.Create(WizardForm); with lblRedist do begin Caption:='Установить MS Visual C++ 2005'; Left:= WizardForm.DirEdit.Left + 220; Top:= WizardForm.DirEdit.Top + 70; Width:= ScaleX(150); Height:= ScaleY(13); Transparent := True; Parent:= WizardForm.SelectDirPage; OnClick:= @RedistOnClick; end; Icons:= TCheckBox.Create(WizardForm); with Icons do begin Parent:= WizardForm.SelectDirPage; Left:= WizardForm.DirEdit.Left; Top:= WizardForm.DirEdit.Top + 35; Width:= ScaleX(14); Height:= ScaleY(14); TabOrder:= 2; Checked:= False; end; lblIcons:= TLabel.Create(WizardForm); with lblIcons do begin Caption:='Создать ярлык на рабочем столе'; Left:= WizardForm.DirEdit.Left + 20; Top:= WizardForm.DirEdit.Top + 35; Width:= ScaleX(150); Height:= ScaleY(13); Transparent := True; Parent:= WizardForm.SelectDirPage; OnClick:= @IconsOnClick; end; Group:= TCheckBox.Create(WizardForm); with Group do begin Parent:= WizardForm.SelectDirPage; Left:= WizardForm.DirEdit.Left; Top:= WizardForm.DirEdit.Top + 70; Width:= ScaleX(14); Height:= ScaleY(14); TabOrder:= 3; Checked:= False; end; lblGroup:= TLabel.Create(WizardForm); with lblGroup do begin Caption:='Создать ярлыки в меню "Пуск"'; Left:= WizardForm.DirEdit.Left + 20; Top:= WizardForm.DirEdit.Top + 70; Width:= ScaleX(150); Height:= ScaleY(13); Transparent := True; Parent:= WizardForm.SelectDirPage; OnClick:= @GroupOnClick; end; // создаём lblSelectDir lblSelectDir:= TLabel.Create(WizardForm); with lblSelectDir do begin Caption:= WizardForm.SelectDirLabel.Caption; Left:= ScaleX(40); Top:= WizardForm.SelectDirLabel.Top + ScaleY(62); Width:= WizardForm.SelectDirLabel.Width; Height:= WizardForm.SelectDirLabel.Height; Transparent := True; Parent:= WizardForm.SelectDirPage; end; // создаём lblSelectDirBrowse lblSelectDirBrowse:= TLabel.Create(WizardForm); with lblSelectDirBrowse do begin Caption:= WizardForm.SelectDirBrowseLabel.Caption; Left:= ScaleX(40); Top:= WizardForm.SelectDirBrowseLabel.Top + ScaleY(62); Width:= WizardForm.SelectDirBrowseLabel.Width; Height:= WizardForm.SelectDirBrowseLabel.Height; WordWrap:= True; Transparent:= True; Parent:= WizardForm.SelectDirPage; end; NeedSpaceLabel:= TLabel.Create(WizardForm); with NeedSpaceLabel do begin Parent:= WizardForm.SelectDirPage; Left:= WizardForm.DirEdit.Left; Top:= ScaleY(262); Width:= ScaleX(209); Height:= ScaleY(13); Transparent:= True; end; FreeSpaceLabel:= TLabel.Create(WizardForm); with FreeSpaceLabel do begin Parent:= WizardForm.SelectDirPage; Left:= WizardForm.DirEdit.Left; Top:= ScaleY(280); Width:= ScaleX(209); Height:= ScaleY(13); Transparent:= True; end; WizardForm.DirEdit.OnChange:= @GetFreeSpaceCaption; WizardForm.DirEdit.Text:= WizardForm.DirEdit.Text + #0; PageNameLabel:= TLabel.Create(WizardForm); with PageNameLabel do begin Left:= WizardForm.PageNameLabel.Left; Top:= WizardForm.PageNameLabel.Top; Width:= ScaleX(300); Height:= ScaleY(14); AutoSize:= False; Font.Style:= [fsBold]; Font.Color:= ClWhite; Transparent := True; Parent:= WizardForm.SelectDirPage; end; PageNameLabel1:= TLabel.Create(WizardForm); with PageNameLabel1 do begin Left:= WizardForm.PageNameLabel.Left; Top:= WizardForm.PageNameLabel.Top; Width:= ScaleX(300); Height:= ScaleY(14); AutoSize:= False; Font.Style:= [fsBold]; Font.Color:= ClWhite; Transparent := True; Parent:= WizardForm.InstallingPage; end; PageDescriptionLabel:= TLabel.Create(WizardForm); with PageDescriptionLabel do begin Left:= WizardForm.PageDescriptionLabel.Left; Top:= WizardForm.PageDescriptionLabel.top; Width:= WizardForm.PageDescriptionLabel.Width; Height:= WizardForm.PageDescriptionLabel.Height; AutoSize:= False; Transparent := True; Parent:= WizardForm.SelectDirPage; end; PageDescriptionLabel1:= TLabel.Create(WizardForm); with PageDescriptionLabel1 do begin Left:= WizardForm.PageDescriptionLabel.Left; Top:= WizardForm.PageDescriptionLabel.top; Width:= WizardForm.PageDescriptionLabel.Width; Height:= WizardForm.PageDescriptionLabel.Height; AutoSize:= False; Transparent := True; Parent:= WizardForm.InstallingPage; end; StatusLabel:= TLabel.Create(WizardForm); with StatusLabel do begin Left:= ScaleX(20); Top:= ScaleY(100); Width:= WizardForm.StatusLabel.Width; Height:= WizardForm.StatusLabel.Height; AutoSize:= False; Transparent := True; Parent:= WizardForm.InstallingPage; end; end; procedure CurPageChanged(CurPageID: Integer); begin PageNameLabel.Caption:= WizardForm.PageNameLabel.Caption; PageDescriptionLabel.Caption:= WizardForm.PageDescriptionLabel.Caption; PageNameLabel1.Caption:= WizardForm.PageNameLabel.Caption; PageDescriptionLabel1.Caption:= WizardForm.PageDescriptionLabel.Caption; if CurPageID = wpSelectDir then begin WizardForm.NextButton.Caption:= ExpandConstant('{cm:BUT}'); GetNeedSpaceCaption; if FreeMB < NeedSize then WizardForm.NextButton.Enabled:=False; begin if CurPageID=wpInstalling then if CurPageID=wpFinished then begin WizardForm.Width:=497; WizardForm.Height:=358; WizardForm.Position:=poScreenCenter; end end; end; end; end. | Всего записей: 79 | Зарегистр. 29-04-2009 | Отправлено: 19:31 10-07-2009 | Исправлено: STRATEG1992, 19:41 10-07-2009 |
|