Имя пользователя:
Пароль:  
Помощь | Регистрация | Забыли пароль?  

Показать сообщение отдельно

Аватара для Habetdin


Автор проектов


Сообщения: 3652
Благодарности: 1498

Профиль | Сайт | Отправить PM | Цитировать


alex2010, попробуйте:
читать дальше »
Код: Выделить весь код
[code]
var
SelectDirText_1: TLabel;
FreeMB, TotalMB: Cardinal;
NeedSize: Integer;
pnl: TPanel;

Function NumToStr(Float: Extended): String;
Begin
Result:= Format('%.2n', [Float]); StringChange(Result, ',', '.');
while ((Result[Length(Result)] = '0') or (Result[Length(Result)] = '.')) and (Pos('.', Result) > 0) do
SetLength(Result, Length(Result)-1);
End;
//=================
procedure GetFreeSpaceCaption(Sender: TObject);
var
Path: String;
begin
Path := ExtractFileDrive(WizardForm.DirEdit.Text);
GetSpaceOnDisk(Path, True, FreeMB, TotalMB);
if FreeMB > 1024 then
SelectDirText_1.Caption := ExpandConstant('{cm:SPACE_2} ')+ NumToStr(round(FreeMB/1024*100)/100) + ' GB'
else
SelectDirText_1.Caption := ExpandConstant('{cm:SPACE_2} ')+ NumToStr(FreeMB)+ ' MB';
//---------------------------
if FreeMB < NeedSize then
begin
SelectDirText_1.Font.Color:= ClRed;
WizardForm.NextButton.Enabled := False;
end else
begin
SelectDirText_1.Font.Color:= ClBlack;
WizardForm.NextButton.Enabled := True;
end
end;
//===================
procedure GetNeedSpaceCaption;
begin
if NeedSize > 1024 then
WizardForm.DiskSpaceLabel.Caption := ExpandConstant('{cm:SPACE_1} ')+ NumToStr(round(NeedSize/1024*100)/100) + ' GB' else
WizardForm.DiskSpaceLabel.Caption := ExpandConstant('{cm:SPACE_1} ')+ NumToStr(NeedSize)+ ' MB';
//-----------------------
if FreeMB < NeedSize then
begin
SelectDirText_1.Font.Color:= ClRed;
WizardForm.NextButton.Enabled := False;
end else
begin
SelectDirText_1.Font.Color:= ClBlack;
WizardForm.NextButton.Enabled := True;
end
end;

///////////////////////WelcomePage//////////////////////////////////////
procedure WelcomePage;
begin
with TLabel.Create(pnl) do
begin
AutoSize:= WizardForm.WelcomeLabel1.AutoSize;
SetBounds(WizardForm.WelcomeLabel1.Left,WizardForm.WelcomeLabel1.Top,
WizardForm.WelcomeLabel1.Width,WizardForm.WelcomeLabel1.Height);
WordWrap:= WizardForm.WelcomeLabel1.WordWrap;
Caption:= WizardForm.WelcomeLabel1.Caption;
with Font do
begin
Color:= WizardForm.WelcomeLabel1.Font.Color;
Style:= WizardForm.WelcomeLabel1.Font.Style;
Name:= WizardForm.WelcomeLabel1.Font.Name;
Size:= WizardForm.WelcomeLabel1.Font.Size;
end;
Transparent:= True;
Parent:= pnl;
end;
with TLabel.Create(pnl) do
begin
AutoSize:= WizardForm.WelcomeLabel2.AutoSize;
SetBounds(WizardForm.WelcomeLabel2.Left,WizardForm.WelcomeLabel2.Top,
WizardForm.WelcomeLabel2.Width,WizardForm.WelcomeLabel2.Height);
WordWrap:= WizardForm.WelcomeLabel2.WordWrap;
Caption:= WizardForm.WelcomeLabel2.Caption;
with Font do
begin
Color:= WizardForm.WelcomeLabel2.Font.Color;
Style:= WizardForm.WelcomeLabel2.Font.Style;
Name:= WizardForm.WelcomeLabel2.Font.Name;
Size:= WizardForm.WelcomeLabel2.Font.Size;
end;
Transparent:= True;
Parent:= pnl;
end;
pnl.Repaint;
end;
/////////////////////////////////////////////////////////////////

///////////////////////SelectDirPage//////////////////////////////////////
procedure SelectDirPage;
begin
with WizardForm do
begin
with DirEdit do
begin
Left:= 40;
Top:= 137;
Parent:= pnl;
end;
with DirBrowseButton do
begin
Left:= WizardForm.DirEdit.Left + WizardForm.DirEdit.Width + 10;
Top:= WizardForm.DirEdit.Top - 1;
Parent:= pnl;
end;
with SelectDirBitmapImage do
begin
Left:= WizardForm.DirEdit.Left;
Top:= WizardForm.DirEdit.Top - 62;
Stretch:= True;
Parent:= pnl;
end;
end;
with TLabel.Create(pnl) do
begin
AutoSize:= WizardForm.SelectDirBrowseLabel.AutoSize;
SetBounds(WizardForm.DirEdit.Left,WizardForm.DirEdit.Top - 30,
WizardForm.SelectDirBrowseLabel.Width, WizardForm.SelectDirBrowseLabel.Height);
WordWrap:= WizardForm.SelectDirBrowseLabel.WordWrap;
Caption:= WizardForm.SelectDirBrowseLabel.Caption;
with Font do
begin
Color:= WizardForm.SelectDirBrowseLabel.Font.Color;
Style:= WizardForm.SelectDirBrowseLabel.Font.Style;
Name:= WizardForm.SelectDirBrowseLabel.Font.Name;
Size:= WizardForm.SelectDirBrowseLabel.Font.Size;
end;
Transparent:= True;
Parent:= pnl;
end;
with TLabel.Create(pnl) do
begin
AutoSize:= WizardForm.SelectDirLabel.AutoSize;
SetBounds(WizardForm.SelectDirBitmapImage.Left + 50,WizardForm.SelectDirBitmapImage.Top + 10,
WizardForm.SelectDirLabel.Width,WizardForm.SelectDirLabel.Height);
WordWrap:= WizardForm.SelectDirLabel.WordWrap;
Caption:= WizardForm.SelectDirLabel.Caption;
with Font do
begin
Color:= WizardForm.SelectDirLabel.Font.Color;
Style:= WizardForm.SelectDirLabel.Font.Style;
Name:= WizardForm.SelectDirLabel.Font.Name;
Size:= WizardForm.SelectDirLabel.Font.Size;
end;
Transparent:= True;
Parent:= pnl;
end;
with TLabel.Create(pnl) do
begin
AutoSize:= WizardForm.DiskSpaceLabel.AutoSize;
SetBounds(WizardForm.DirEdit.Left,WizardForm.Bevel.Top - 25,
WizardForm.DiskSpaceLabel.Width,WizardForm.DiskSpaceLabel.Height);
WordWrap:= WizardForm.DiskSpaceLabel.WordWrap;
Caption:= WizardForm.DiskSpaceLabel.Caption;
with Font do
begin
Color:= WizardForm.DiskSpaceLabel.Font.Color;
Style:= WizardForm.DiskSpaceLabel.Font.Style;
Name:= WizardForm.DiskSpaceLabel.Font.Name;
Size:= WizardForm.DiskSpaceLabel.Font.Size;
end;
Transparent:= True;
Parent:= pnl;
end;
pnl.Repaint;
end;
/////////////////////////////////////////////////////////////////

///////////////////////ReadyPage//////////////////////////////////////
procedure ReadyPage;
var
ready_str: string;
begin
ready_str:= WizardForm.ReadyMemo.Text;
with TLabel.Create(pnl) do
begin
SetBounds(45,115,WizardForm.ReadyMemo.Width, WizardForm.ReadyMemo.Height);
Caption:= ready_str;
with Font do
begin
Color:= WizardForm.ReadyLabel.Font.Color;
Style:= WizardForm.ReadyLabel.Font.Style;
Name:= WizardForm.ReadyLabel.Font.Name;
Size:= WizardForm.ReadyLabel.Font.Size;
end;
Transparent:= True;
Parent:= pnl;
end;
with TBevel.Create(WizardForm) do
begin
SetBounds(40,110, WizardForm.ReadyMemo.Width, WizardForm.ReadyMemo.Height);
Parent:= pnl;
end;
with TLabel.Create(pnl) do
begin
AutoSize:= WizardForm.ReadyLabel.AutoSize;
SetBounds(40,70, WizardForm.ReadyLabel.Width, WizardForm.ReadyLabel.Height);
WordWrap:= WizardForm.ReadyLabel.WordWrap;
Caption:= WizardForm.ReadyLabel.Caption;
with Font do
begin
Color:= WizardForm.ReadyLabel.Font.Color;
Style:= WizardForm.ReadyLabel.Font.Style;
Name:= WizardForm.ReadyLabel.Font.Name;
Size:= WizardForm.ReadyLabel.Font.Size;
end;
Transparent:= True;
Parent:= pnl;
end;
pnl.Repaint;
end;
/////////////////////////////////////////////////////////////////

///////////////////////InstallingPage//////////////////////////////////////
procedure InstallingPage;
begin
with WizardForm.ProgressGauge do
begin
Left:= 40;
Top:= 115;
Parent:= pnl;
end;
with TLabel.Create(pnl) do
begin
AutoSize:= WizardForm.FilenameLabel.AutoSize;
SetBounds(WizardForm.ProgressGauge.Left,WizardForm.ProgressGauge.Top-20,
WizardForm.FilenameLabel.Width,WizardForm.FilenameLabel.Height);
WordWrap:= WizardForm.FilenameLabel.WordWrap;
Caption:= WizardForm.FilenameLabel.Caption;
with Font do
begin
Color:= WizardForm.FilenameLabel.Font.Color;
Style:= WizardForm.FilenameLabel.Font.Style;
Name:= WizardForm.FilenameLabel.Font.Name;
Size:= WizardForm.FilenameLabel.Font.Size;
end;
Transparent:= True;
Parent:= pnl;
end;
with TLabel.Create(pnl) do
begin
AutoSize:= WizardForm.StatusLabel.AutoSize;
SetBounds(WizardForm.StatusLabel.Left,WizardForm.StatusLabel.Top,
WizardForm.StatusLabel.Width,WizardForm.StatusLabel.Height);
WordWrap:= WizardForm.StatusLabel.WordWrap;
Caption:= WizardForm.StatusLabel.Caption;
with Font do
begin
Color:= WizardForm.StatusLabel.Font.Color;
Style:= WizardForm.StatusLabel.Font.Style;
Name:= WizardForm.StatusLabel.Font.Name;
Size:= WizardForm.StatusLabel.Font.Size;
end;
Transparent:= True;
Parent:= pnl;
end;
pnl.Repaint;
end;
/////////////////////////////////////////////////////////////////

///////////////////////FinishedPage//////////////////////////////////////
var
CheckBox: array of TNewCheckBox;

procedure CheckBoxClick(Sender: TObject);
begin
if TNewCheckBox(Sender).Checked then
WizardForm.RunList.Checked[TNewCheckBox(Sender).Tag]:= True
else WizardForm.RunList.Checked[TNewCheckBox(Sender).Tag]:= False;
end;

procedure LabelClick(Sender: TObject);
begin
if CheckBox[TLabel(Sender).Tag].Checked then
begin
WizardForm.RunList.Checked[TLabel(Sender).Tag]:= False;
CheckBox[TLabel(Sender).Tag].Checked:= False;
end
else
begin
WizardForm.RunList.Checked[TLabel(Sender).Tag]:= True;
CheckBox[TLabel(Sender).Tag].Checked:= True;
end;
end;

procedure HideRunList(Control: TWinControl);
var
i, t: Integer;
str: string;
begin
if WizardForm.RunList.Items.Count > 0 then
begin
WizardForm.RunList.Hide;
SetArrayLength(CheckBox, SizeOf(WizardForm.RunList.Items.Count));
for i:= 0 to WizardForm.RunList.Items.Count-1 do
begin
CheckBox[i]:= TNewCheckBox.Create(Control);
with CheckBox[i] do
begin
SetBounds(ScaleX(WizardForm.RunList.Left+2),ScaleY(WizardForm.RunList.Top+2+t),14,14);
Tag:= i;
Checked:= WizardForm.RunList.Checked[i];
Caption:= WizardForm.RunList.Items.Strings[i];
OnClick:= @CheckBoxClick;
Color:= clWhite;
Parent:= Control;
end;
str:= WizardForm.RunList.Items.Strings[i];
with TLabel.Create(WizardForm) do
begin
SetBounds(ScaleX(WizardForm.RunList.Left+20),ScaleY(WizardForm.RunList.Top+2+t),
WizardForm.RunList.Width,14);
Caption:= str;
Tag:= i;
OnClick:= @LabelClick;
Transparent:= True;
Parent:= Control;
end;
t:= t + 20;
end;
end;
end;

procedure FinishedPage;
begin
HideRunList(pnl);
with TLabel.Create(pnl) do
begin
AutoSize:= WizardForm.FinishedHeadingLabel.AutoSize;
SetBounds(WizardForm.FinishedHeadingLabel.Left,WizardForm.FinishedHeadingLabel.Top,
WizardForm.FinishedHeadingLabel.Width,WizardForm.FinishedHeadingLabel.Height);
WordWrap:= WizardForm.FinishedHeadingLabel.WordWrap;
Caption:= WizardForm.FinishedHeadingLabel.Caption;
with Font do
begin
Color:= WizardForm.FinishedHeadingLabel.Font.Color;
Style:= WizardForm.FinishedHeadingLabel.Font.Style;
Name:= WizardForm.FinishedHeadingLabel.Font.Name;
Size:= WizardForm.FinishedHeadingLabel.Font.Size;
end;
Transparent:= True;
Parent:= pnl;
end;
with TLabel.Create(pnl) do
begin
AutoSize:= WizardForm.FinishedLabel.AutoSize;
SetBounds(WizardForm.FinishedLabel.Left,WizardForm.FinishedLabel.Top,
WizardForm.FinishedLabel.Width,WizardForm.FinishedLabel.Height);
WordWrap:= WizardForm.FinishedLabel.WordWrap;
Caption:= WizardForm.FinishedLabel.Caption;
with Font do
begin
Color:= WizardForm.FinishedLabel.Font.Color;
Style:= WizardForm.FinishedLabel.Font.Style;
Name:= WizardForm.FinishedLabel.Font.Name;
Size:= WizardForm.FinishedLabel.Font.Size;
end;
Transparent:= True;
Parent:= pnl;
end;
pnl.Repaint;
end;
/////////////////////////////////////////////////////////////////

procedure CurPageChanged(CurPageID: Integer);
begin
pnl:= TPanel.Create(WizardForm);
with pnl do
begin
Align:= alClient;
Parent:= WizardForm;
end;
with WizardForm do
begin
with WizardBitmapImage do
begin
Align:= alClient;
Stretch:= True;
Parent:= pnl;
end;
NextButton.Parent:= pnl;
CancelButton.Parent:= pnl;
BackButton.Parent:= pnl;
Bevel.Parent:= pnl;
pnl.Repaint;
end;

if (CurPageID > wpWelcome) and (CurPageID < wpFinished) then
begin
WizardForm.Bevel1.Parent:= pnl;
with TLabel.Create(pnl) do
begin
AutoSize:= WizardForm.PageNameLabel.AutoSize;
SetBounds(WizardForm.PageNameLabel.Left,WizardForm.PageNameLabel.Top,
WizardForm.PageNameLabel.Width,WizardForm.PageNameLabel.Height);
Caption:= WizardForm.PageNameLabel.Caption;
with Font do
begin
Color:= WizardForm.PageNameLabel.Font.Color;
Style:= WizardForm.PageNameLabel.Font.Style;
Name:= WizardForm.PageNameLabel.Font.Name;
Size:= WizardForm.PageNameLabel.Font.Size;
end;
Transparent:= True;
Parent:= pnl;
end;
with TLabel.Create(pnl) do
begin
AutoSize:= WizardForm.PageDescriptionLabel.AutoSize;
SetBounds(WizardForm.PageDescriptionLabel.Left,WizardForm.PageDescriptionLabel.Top,
WizardForm.PageDescriptionLabel.Width,WizardForm.PageDescriptionLabel.Height);
Caption:= WizardForm.PageDescriptionLabel.Caption;
with Font do
begin
Color:= WizardForm.PageDescriptionLabel.Font.Color;
Style:= WizardForm.PageDescriptionLabel.Font.Style;
Name:= WizardForm.PageDescriptionLabel.Font.Name;
Size:= WizardForm.PageDescriptionLabel.Font.Size;
end;
Transparent:= True;
Parent:= pnl;
end;
pnl.Repaint;
end;
If CurPageID=wpSelectDir then
begin
SelectDirPage;
NeedSize:= 4054; // óêàçûâàåì ðàçìåð ðàñïàêîâàííîãî ìíñòàëëÿòîðà â MB

SelectDirText_1:= TLabel.Create(WizardForm);
with SelectDirText_1 do
begin
Parent:= WizardForm.SelectDirPage;
Top:= ScaleY(220);
Width:= ScaleX(209);
Height:= ScaleY(13);
Font.Size:= 8;
Font.Color:= ClBlack;
Transparent:= True;
end;

WizardForm.DiskSpaceLabel.Top:= ScaleY(200);
WizardForm.DirEdit.OnChange:= @GetFreeSpaceCaption;
WizardForm.DirEdit.Text:= WizardForm.DirEdit.Text + #0;

GetNeedSpaceCaption;
end

if CurPageID = wpWelcome then WelcomePage;
if CurPageID = wpReady then ReadyPage;
if CurPageID = wpInstalling then InstallingPage;
if CurPageID = wpFinished then FinishedPage;
end;

-------
Рекомендую: $25 на тест виртуального сервера (VPS) за регистрацию по ссылке

Это сообщение посчитали полезным следующие участники:

Отправлено: 14:29, 12-03-2010 | #1515