Автор: Serega0675
Дата сообщения: 12.04.2009 21:52
Yoldosh
[more=так]
Код: [Setup]
AppName=Vin Diesel Wheelman
AppVerName=Vin Diesel Wheelman
DefaultDirName={pf}\Vin Diesel Wheelman
OutputDir=E:\Proekt
WizardImageFile=E:\Logo\WizardImageFile.bmp
WizardSmallImageFile=E:\Logo\WizardSmallImageFile.bmp
DisableReadyPage=true
UninstallFilesDir={app}\Uninstall
[Languages]
Name: "ENG"; MessagesFile: "compiler:Default.isl"
Name: "RUS"; MessagesFile: "compiler:Languages\Russian.isl"
[Files]
Source: "C:\Program Files\Inno Setup 5\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\Soft\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: E:\3.bmp; DestDir: {tmp}; Flags: dontcopy
Source: E:\1.bmp; Flags: dontcopy;
[Run]
Filename: {src}\DirectX\dxsetup.exe; Parameters: /silent; StatusMsg: ExpandConstant('{cm:UP}'); Check: DirectX
[CustomMessages]
ENG.PAGE_CAPTION=Setup has finished installing Vin Diesel Wheelman on your computer.
RUS.PAGE_CAPTION=Программа Vin Diesel Wheelman установлена на Ваш компютер.
ENG.STR=Click Finish to exit Setup.
RUS.STR=Нажмите «Завершить», чтобы выйти из программы установки.
ENG.BUT=Install
RUS.BUT=Установить
ENG.SPACE=Available place on disk:
RUS.SPACE=Доступно места на диске:
ENG.SPACE1=Place is Required on disk:
RUS.SPACE1=Требуется места на диске:
ENG.DRT=Will Update DirectX
RUS.DRT=Обновить DirectX
ENG.UP=Goes the renovation DirectX...
RUS.UP=Идет обновление DirectX...
[Code]
var
Upload: TCheckBox;
bottom_img:TBitmapImage;
lblCheckBox, lblSelectDir, lblSelectDirBrowse: TLabel;
PageNameLabel, PageDescriptionLabel: TLabel;
WLabel1, WLabel2,
FLabel1, FLabel2, FLabel3: TLabel;
NeedSize:Integer;
FreeMB, TotalMB: Cardinal;
NeedSpaceLabel,FreeSpaceLabel: TLabel;
BmpFile: TBitmapImage;
function DirectX: Boolean;
begin
Result:=Upload.Checked;
end;
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;
// задал процедуру, чтоб отмечался чебокс еси кликнуть по надписи lblCheckBox
procedure lblCheckBoxOnClick(Sender: TObject);
begin
if Upload.Checked = False then
Upload.Checked:= True else
Upload.Checked:= False;
end;
procedure InitializeWizard();
begin
ExtractTemporaryFile('1.bmp');
ExtractTemporaryFile('3.bmp');
NeedSize:= 7000;
BmpFile:= TBitmapImage.Create(WizardForm);
BmpFile.Bitmap.LoadFromFile(ExpandConstant('{tmp}\1.bmp'));
BmpFile.Width:= ScaleX(497);
BmpFile.Height:= ScaleY(252);
BmpFile.Parent:= WizardForm.SelectDirPage;
bottom_img:= TBitmapImage.Create(WizardForm);
bottom_img.Bitmap.LoadFromFile(ExpandConstant('{tmp}\3.bmp'));
{первые 2 параметра - координаты левогого верхнего угла по горизонтали и вертикали, дальше ширина и высота,
до которой растянуть}
bottom_img.SetBounds(0, 315, 497, 48);
bottom_img.Parent:= WizardForm;
bottom_img.Stretch:= True;
with WizardForm do
begin
PageNameLabel.Hide;
PageDescriptionLabel.Hide;
WelcomeLabel1.Hide;
WelcomeLabel2.Hide;
DiskSpaceLabel.Hide;
SelectDirBitmapImage.Hide;
SelectDirBrowseLabel.Hide;
SelectDirLabel.Hide;
FinishedHeadingLabel.Hide;
FinishedLabel.Hide;
DirBrowseButton.Left:= DirBrowseButton.Left + ScaleX(40);
DirBrowseButton.Top:= DirBrowseButton.Top + ScaleY(12);
DirEdit.Left:= DirEdit.Left + ScaleX(40);
DirEdit.Top:= DirEdit.Top + ScaleY(12);
WizardBitmapImage.Width:= 497;
WizardBitmapImage.Height:= 314;
WizardBitmapImage2.Width:= 497;
WizardBitmapImage2.Height:= 314;
with MainPanel do
begin
with WizardSmallBitmapImage do
begin
Left:= Mainpanel.Left;
Top:= Mainpanel.Top;
Width:= Mainpanel.Width;
Height:= MainPanel.Height;
end;
end;
end;
WLabel1:= TLabel.Create(WizardForm);
with WLabel1 do
begin
Left:= ScaleX(176);
Top:= ScaleY(16);
Width:= ScaleX(301);
Height:= ScaleY(54);
AutoSize:= False;
WordWrap:= True;
Font.Size:= 12;
Font.Style:= [fsBold];
Font.Color:= clblack;
ShowAccelChar:= False;
Caption:= WizardForm.WelcomeLabel1.Caption;
Transparent:= True;
Parent:= WizardForm.WelcomePage;
end;
WLabel2:=TLabel.Create(WizardForm);
with WLabel2 do
begin
Top:= ScaleY(76);
Left:= ScaleX(176);
Width:= ScaleX(301);
Height:= ScaleY(234);
AutoSize:= False;
WordWrap:= True;
Font.Color:= clblack;
ShowAccelChar:= False;
Caption:= WizardForm.WelcomeLabel2.Caption;
Transparent:= True;
Parent:= WizardForm.WelcomePage;
end;
FLabel1:= TLabel.Create(WizardForm);
with FLabel1 do
begin
Left:= ScaleX(176);
Top:= ScaleY(16);
Width:= ScaleX(301);
Height:= ScaleY(54);
AutoSize:= False;
WordWrap:= True;
Font.Size:= 12;
Font.Style:= [fsBold];
Font.Color:= clblack;
ShowAccelChar:= False;
Caption:= WizardForm.FinishedHeadingLabel.Caption;
Transparent:= True;
Parent:= WizardForm.FinishedPage;
end;
FLabel2:=TLabel.Create(WizardForm);
with FLabel2 do
begin
Top:= ScaleY(76);
Left:= ScaleX(176);
Width:= ScaleX(301);
Height:= ScaleY(53);
AutoSize:= False;
WordWrap:= True;
Font.Color:= clblack;
ShowAccelChar:= False;
Caption:= ExpandConstant('{cm:PAGE_CAPTION}');
Transparent:= True;
Parent:= WizardForm.FinishedPage;
end;
FLabel3 :=TLabel.Create(WizardForm);
with FLabel3 do
begin
Top := ScaleY(110);
Left := ScaleX(176);
Width := ScaleX(301);
Height := ScaleY(53);
AutoSize := False;
WordWrap := True;
Font.Color:= clblack;
ShowAccelChar := False;
Caption := ExpandConstant('{cm:STR}');
Transparent := True;
Parent := WizardForm.FinishedPage;
end;
// уменьшил размер CheckBox'а, по другому никак
Upload:= TCheckBox.Create(WizardForm);
with Upload do
begin
Parent:= WizardForm.SelectDirPage;
Left:= WizardForm.DirEdit.Left;
Top:= WizardForm.DirEdit.Top + 35;
Width:= ScaleX(14);
Height:= ScaleY(14);
TabOrder:= 0;
Checked:= False;
end;
// создаём надпись для CheckBox'а
lblCheckBox:= TLabel.Create(WizardForm);
with lblCheckBox do
begin
Caption:= ExpandConstant('{cm:DRT}');
Left:= WizardForm.DirEdit.Left + 20;
Top:= WizardForm.DirEdit.Top + 35;
Width:= ScaleX(150);
Height:= ScaleY(13);
Transparent := True;
Parent:= WizardForm.SelectDirPage;
OnClick:= @lblCheckBoxOnClick;
end;
// создаём lblSelectDir
lblSelectDir:= TLabel.Create(WizardForm);
with lblSelectDir do
begin
Caption:= WizardForm.SelectDirLabel.Caption;
Left:= ScaleX(40);
Top:= WizardForm.SelectDirLabel.Top + ScaleY(12);
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(12);
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(202);
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(220);
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:= ScaleX(10);
Top:= ScaleY(10);
Width:= ScaleX(300);
Height:= ScaleY(14);
AutoSize:= False;
WordWrap:= True;
Font.Color:= clblack;
Font.Style:= [fsBold];
Transparent:= True;
Parent:= WizardForm.MainPanel;
end;
PageDescriptionLabel:= TLabel.Create(WizardForm);
with PageDescriptionLabel do
begin
Left:= ScaleX(15);
Top:= ScaleY(25);
Width:= ScaleX(475);
Height:= ScaleY(30);
AutoSize:= False;
WordWrap:= True;
Font.Color:= clblack;
Transparent:= True;
Parent:= WizardForm.MainPanel;
end;
end;
procedure CurPageChanged(CurPageID: Integer);
begin
PageNameLabel.Caption:= WizardForm.PageNameLabel.Caption;
PageDescriptionLabel.Caption:= WizardForm.PageDescriptionLabel.Caption;
if CurPageID = wpSelectDir then
begin
WizardForm.NextButton.Caption:= ExpandConstant('{cm:BUT}');
GetNeedSpaceCaption;
if FreeMB < NeedSize then
WizardForm.NextButton.Enabled:=False;
with WizardForm do
begin
InnerNotebook.Left := ScaleX(0);
InnerNotebook.Top := ScaleY(60);
InnerNotebook.Width := ScaleX(497);
InnerNotebook.Height := ScaleY(252)
end;
end;
if CurPageID = wpInstalling then
begin
with WizardForm do
begin
ProgressGauge.Left:= 20;
ProgressGauge.Top:= 160;
ProgressGauge.Width:= 215;
ProgressGauge.Height:= 20;
end;
end;
end;