PDA

Показать полную графическую версию : Скрипты Inno Setup. Помощь и советы [часть 6]


Страниц : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 [27] 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125

Aquila
21-05-2013, 20:23
Mailchik, А этот чек ( Check: ) можно применить не только к [Icons]?

saurn
21-05-2013, 20:55
Aquila, аналогично к [Dirs], [Files], [Registry], [INI], [Run] и т.д.

Crazy Noise
21-05-2013, 20:56
Aquila,

[Setup]
AppName=My Program
AppVersion=1.5
;AppVerName=My Program 1.5
DefaultDirName={pf}\My Program
DefaultGroupName=My Program
OutputDir=.

[Components]
Name: ag; Description: Aquila; Check: AquilaComp

[Icons]
Name: {group}\{cm:UninstallProgram,My Program}; Filename: {uninstallexe}; Check: GroupIcon
Name: {commondesktop}\{cm:UninstallProgram,My Program}; Filename: {uninstallexe}; Check: DesktopIcon
Name: {commondesktop}\Aquila\{cm:UninstallProgram,My Program}; Filename: {uninstallexe}; Check: AquilaIcon


[Code]
function CheckParam(s: string): boolean;
var
i: integer;
begin
for i := 0 to ParamCount do begin
Result := ParamStr(i) = s;
if Result then Break;
end;
end;


function GroupIcon: boolean;
begin
Result := CheckParam('iGroup');
end;


function DesktopIcon: boolean;
begin
Result := CheckParam('iDesktop');
end;



function AquilaIcon: boolean;
begin
Result := CheckParam('iAquila');
end;



// Можно и к компонентам прикрутить
function AquilaComp: boolean;
begin
Result := CheckParam('iAquilaComponents');
end;

Как в исходном коде приведённый в посте (http://forum.oszone.net/post-2153695-517.html) от Mailchik (http://forum.oszone.net/member.php?userid=387523)
setup.exe iAquila

Пример для компонентов
setup.exe iAquilaComponents

Aquila
21-05-2013, 21:23
iAquilaComponents »
Красиво :happy:

Crazy Noise
22-05-2013, 04:20
опять таки же, не проверял »Благодарю! Проверил, работает.

Сейчас зациклился на MsgBox. Где-то что-то не правильно делаю, либо вообще не туда полез.
Т.к ключ должен быть в любом случае, то значит должна быть проверка на то введён ключ в инсталляторе или нет
т.е если в инсталляторе окошки пусты, либо не хватает буквы или цифры то при нажатии на далее выводил сообщение MsgBox('Вы должны ввести ключ.', mbError, MB_OK);, либо же кнопка далее была бы не активна до тех пор пока весь ключ не будет введён, вот что-то одно.

function NextButtonClick(CurPageID:integer): Boolean;
begin
case CurPageID of
SerialPage.ID:
begin
CreateDir(ExpandConstant('{userdocs}\GameEX'));
SaveStringToFile(ExpandConstant('{userdocs}\GameEX\keysgame.ini'), EditsNumber, False);
MsgBox('Вы должны ввести ключ.', mbError, MB_OK);
end;
end;
Result := True;
end;

function ShouldSkipPage(PageID: Integer): Boolean;
begin
case PageID of
SerialPage.ID: Result := FileExists(ExpandConstant('{userdocs}\GameEX\keysgame.ini'));
end;
end;

Mailchik
22-05-2013, 09:00
Crazy Noise, function NextButtonClick(CurPageID:integer): Boolean;
var
i: integer;
begin
Result := True;
case CurPageID of
SerialPage.ID:
begin
CreateDir(ExpandConstant('{userdocs}\GameEX'));
SaveStringToFile(ExpandConstant('{userdocs}\GameEX\keysgame.ini'), EditsNumber, False);
for i := 1 to 4 do begin
Result := Edits[i].GetTextLen = 4;
if not Result then begin
MsgBox('Вы должны ввести ключ.', mbError, MB_OK);
Break;
end;
end;
end;
end;
end;

Crazy Noise
22-05-2013, 15:27
Mailchik, Благодарю!
А как сделать, чтоб когда набираешь код, то автоматически переходило в следующее окошко, а не так чтоб мышью выбирать? Возможно так сделать?

Mailchik
22-05-2013, 19:08
А как сделать, чтоб когда набираешь код, то автоматически переходило в следующее окошко, а не так чтоб мышью выбирать? Возможно так сделать? »
В двух вариантах:
если в инсталляторе окошки пусты, либо не хватает буквы или цифры то при нажатии на далее выводил сообщение »
[Setup]
AppName=My Application
AppVersion=1.5
DefaultDirName={pf}\My Application

[CustomMessages]
MESSAGES_1=Ввод серийного номера
MESSAGES_2=Серийный номер нужен для активации программного обеспечения.
MESSAGES_3=Для активации необходимо ввести серийный номер поставляемый в комплекте с программным обеспечением.

[code]
var
SerialPage: TWizardPage;
Edits: array [1..4] of TEdit;
I, E: Integer;
SerialPage_Label: TNewStaticText;
sNumber: String;

procedure EditsChange(Sender: TObject);
var
i: integer;
begin
for i := 1 to 4 do begin
Edits[i].AutoSelect := False;
if i < 4 then
if Length(Edits[i].Text) = 4 then
Edits[i+1].SetFocus;
end;
end;

function EditsNumber(): string;
begin
for I := 1 to 4 do
begin
sNumber := sNumber + Edits[i].Text + '-';
end;
sNumber := Copy(sNumber, 1, Length(sNumber) - 1);
Result := sNumber;
end;

procedure InitializeWizard();
begin
SerialPage := CreateCustomPage(wpSelectTasks, CustomMessage('MESSAGES_1'), CustomMessage('MESSAGES_2'));
SerialPage_Label := TNewStaticText.Create(nil);
with SerialPage_Label do
begin
Parent := SerialPage.Surface;
SetBounds(ScaleX(0), ScaleY(0), ScaleX(417), ScaleY(28));
WordWrap := True;
Caption := CustomMessage('MESSAGES_3');
end;

E := ScaleX(73);

for I := 1 to 4 do
begin
Edits[i]:= TEdit.Create(nil);
with Edits[i] do
begin
Parent:= SerialPage.Surface;
SetBounds(0 + (E*I), ScaleY(47), ScaleX(47), ScaleY(21));
MaxLength:= 4;
OnChange := @EditsChange;
end;
end;
end;

function NextButtonClick(CurPageID:integer): Boolean;
var
i: integer;
begin
Result := True;
case CurPageID of
SerialPage.ID:
begin
CreateDir(ExpandConstant('{userdocs}\GameEX'));
SaveStringToFile(ExpandConstant('{userdocs}\GameEX\keysgame.ini'), EditsNumber, False);
for i := 1 to 4 do begin
Result := Edits[i].GetTextLen = 4;
if not Result then begin
MsgBox('Вы должны ввести ключ.', mbError, MB_OK);
Break;
end;
end;
end;
end;
end;

function ShouldSkipPage(PageID: Integer): Boolean;
begin
case PageID of
SerialPage.ID: Result := FileExists(ExpandConstant('{userdocs}\GameEX\keysgame.ini'));
end;
end;
-------------------------------------------------------------------------------------
либо же кнопка далее была бы не активна до тех пор пока весь ключ не будет введён »
[Setup]
AppName=My Application
AppVersion=1.5
DefaultDirName={pf}\My Application

[CustomMessages]
MESSAGES_1=Ввод серийного номера
MESSAGES_2=Серийный номер нужен для активации программного обеспечения.
MESSAGES_3=Для активации необходимо ввести серийный номер поставляемый в комплекте с программным обеспечением.

[code]
var
SerialPage: TWizardPage;
Edits: array [1..4] of TEdit;
I, E: Integer;
SerialPage_Label: TNewStaticText;
sNumber: String;

procedure EditsChange(Sender: TObject);
var
i, eLength: integer;
begin
eLength := 0;
for i := 1 to 4 do begin
Edits[i].AutoSelect := False;
if i < 4 then
if Length(Edits[i].Text) = 4 then
Edits[i+1].SetFocus;
eLength := eLength + Length(Edits[i].Text);
end;
WizardForm.NextButton.Enabled := eLength = 4 * 4;
end;

function EditsNumber(): string;
begin
for I := 1 to 4 do
begin
sNumber := sNumber + Edits[i].Text + '-';
end;
sNumber := Copy(sNumber, 1, Length(sNumber) - 1);
Result := sNumber;
end;

procedure InitializeWizard();
begin
SerialPage := CreateCustomPage(wpSelectTasks, CustomMessage('MESSAGES_1'), CustomMessage('MESSAGES_2'));
SerialPage_Label := TNewStaticText.Create(nil);
with SerialPage_Label do
begin
Parent := SerialPage.Surface;
SetBounds(ScaleX(0), ScaleY(0), ScaleX(417), ScaleY(28));
WordWrap := True;
Caption := CustomMessage('MESSAGES_3');
end;

E := ScaleX(73);

for I := 1 to 4 do
begin
Edits[i]:= TEdit.Create(nil);
with Edits[i] do
begin
Parent:= SerialPage.Surface;
SetBounds(0 + (E*I), ScaleY(47), ScaleX(47), ScaleY(21));
MaxLength:= 4;
OnChange := @EditsChange;
end;
end;
end;

function NextButtonClick(CurPageID:integer): Boolean;
var
i: integer;
begin
Result := True;
case CurPageID of
SerialPage.ID:
begin
CreateDir(ExpandConstant('{userdocs}\GameEX'));
SaveStringToFile(ExpandConstant('{userdocs}\GameEX\keysgame.ini'), EditsNumber, False);
end;
end;
end;

function ShouldSkipPage(PageID: Integer): Boolean;
begin
case PageID of
SerialPage.ID: Result := FileExists(ExpandConstant('{userdocs}\GameEX\keysgame.ini'));
end;
end;

procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID = SerialPage.ID then
EditsChange(nil);
end;

habib2302
24-05-2013, 10:16
как добавить чекбокс на создание резервной копии файлов?

saurn
24-05-2013, 10:48
как добавить чекбокс на создание резервной копии файлов? »
[Setup]
AppName=MyApp
AppVerName=MyApp
DefaultDirName={pf}\MyApp
OutputDir=...
Compression=none

[Files]
Source: C:\Windows\Fonts\*; DestDir: {app}; BeforeInstall: CreateBackup(); Flags: recursesubdirs overwritereadonly createallsubdirs ignoreversion;

[Code]
#ifdef UNICODE
type
PChar = PAnsiChar;
#endif

function MoveFile(const TargetFile, BackupFile: PChar):Integer; external 'MoveFileA@kernel32.dll stdcall';

var
CreateBackup_On_Off: TNewCheckBox;

function CheckedBoxes(const iParams: Integer): Boolean;
begin
case iParams of
1: Result := CreateBackup_On_Off.Checked;
end;
end;

procedure CreateBackup();
var
FinalDir, TargetFile, BackupFile, TargetPath, ShortPath: String;
begin
if CheckedBoxes(1) then
begin
TargetPath:= ExpandConstant('{app}');
TargetFile:= ExpandConstant(CurrentFileName);
FinalDir := AddBackslash(ExpandConstant('{app}\Original.old')) + GetDateTimeString('YYYY/MM/DD', '-', '-');
ShortPath:= TargetFile;
StringChangeEx(ShortPath, TargetPath, '', True);
BackupFile:= FinalDir + ShortPath;
ForceDirectories(ExtractFilePath(BackupFile));
MoveFile(PChar(TargetFile), PChar(BackupFile));
end;
end;

procedure InitializeWizard();
begin
CreateBackup_On_Off := TNewCheckBox.Create(nil);
with CreateBackup_On_Off do
begin
Parent := WizardForm.SelectDirPage;
SetBounds(WizardForm.DirEdit.Left, WizardForm.DirEdit.Top + 30, WizardForm.DirEdit.Width, WizardForm.DirEdit.Height);
Caption := 'Сохранить резервную копию перезаписываемых файлов';
end;
end;

habib2302
24-05-2013, 11:24
и как сделать,чтоьы инсталятор перед установкой закрыл процессы

saurn
24-05-2013, 11:51
чтоьы инсталятор перед установкой закрыл процессы »
В шапке пример Закрытие процесса (http://forum.oszone.net/post-2040074-1361.html) от El Sanchez (http://forum.oszone.net/member.php?userid=132675)

wertulll
25-05-2013, 05:58
Всем Привет! Подскажите пожалуйста как к этому скрипту прикрутить ISDone0.6final?

Скрипт
#define MyAppName "S.T.A.L.K.E.R. Зов Припяти"
#define AppVerName "S.T.A.L.K.E.R. Зов Припяти"
#define MyAppExeName "MyProg.exe"

[Setup]
AppName={#MyAppName}
AppVerName={#AppVerName}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
WizardImageFile=Files\WizardImage.bmp
WizardSmallImageFile=Files\WizardSmallImage.bmp

[Languages]
Name: russian; MessagesFile: Files\Russian.isl

[Tasks]
Name: desktopicon; Description: Создать значок на Рабочем столе; GroupDescription: Дополнительные значки:

[Files]
Source: Files\*; Flags: dontcopy
Source: "C:\Program Files (x86)\Inno Setup 5\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon

[code]
const
Color = clblack;
ButtonWidth = 80;
ButtonHeight = 23;

bidBack = 0;
bidNext = 1;
bidCancel = 2;
bidDirBrowse = 3;
bidGroupBrowse = 4;
var
ButtonPanel: array [0..4] of TPanel;
ButtonImage: array [0..4] of TBitmapImage;
ButtonLabel: array [0..4] of TLabel;

procedure ButtonLabelClick(Sender: TObject);
var
Button: TButton;
begin
ButtonImage[TLabel(Sender).Tag].Left:=0
case TLabel(Sender).Tag of
bidBack: Button:=WizardForm.BackButton
bidNext: Button:=WizardForm.NextButton
bidCancel: Button:=WizardForm.CancelButton
bidDirBrowse: Button:=WizardForm.DirBrowseButton
bidGroupBrowse: Button:=WizardForm.GroupBrowseButton
else
Exit
end;
Button.OnClick(Button)
end;

procedure ButtonLabelMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if ButtonLabel[TLabel(Sender).Tag].Enabled then
ButtonImage[TLabel(Sender).Tag].Left:=-ButtonWidth
end;

procedure ButtonLabelMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
ButtonImage[TLabel(Sender).Tag].Left:=0
end;

procedure LoadButtonImage(AButton: TButton; AButtonIndex: integer);
var
Image: TBitmapImage;
Panel: TPanel;
Labl: TLabel;

begin
Panel:=TPanel.Create(WizardForm)
Panel.Left:=AButton.Left
Panel.Top:=AButton.Top
Panel.Width:=AButton.Width
Panel.Height:=AButton.Height
Panel.Tag:=AButtonIndex
Panel.Parent:=AButton.Parent
ButtonPanel[AButtonIndex]:=Panel

Image:=TBitmapImage.Create(WizardForm)
Image.Width:=160
Image.Height:=23
Image.Enabled:=False
Image.Bitmap.LoadFromFile(ExpandConstant('{tmp}\button.bmp'))
Image.Parent:=Panel
ButtonImage[AButtonIndex]:=Image


Labl:=TLabel.Create(WizardForm)
Labl.Top := 5
Labl.Width := Panel.Width
Labl.Height := Panel.Height
Labl.Autosize := False
Labl.Alignment := taCenter
Labl.Tag:=AButtonIndex
Labl.Enabled:= AButton.Enabled
Labl.Transparent:=True
Labl.Font.Color:=clWhite
Labl.Caption:=AButton.Caption
Labl.OnClick:=@ButtonLabelClick
Labl.OnDblClick:=@ButtonLabelClick
Labl.OnMouseDown:=@ButtonLabelMouseDown
Labl.OnMouseUp:=@ButtonLabelMouseUp
Labl.Parent:=Panel
ButtonLabel[AButtonIndex]:=Labl
end;

procedure UpdateButton(AButton: TButton;AButtonIndex: integer);
begin
ButtonLabel[AButtonIndex].Caption:=AButton.Caption
ButtonPanel[AButtonIndex].Visible:=AButton.Visible
ButtonLabel[AButtonIndex].Enabled:=Abutton.Enabled
end;

procedure LicenceAcceptedRadioOnClick(Sender: TObject);
begin
ButtonLabel[bidNext].Enabled:=True
end;

procedure LicenceNotAcceptedRadioOnClick(Sender: TObject);
begin
ButtonLabel[bidNext].Enabled:=False
end;

var
WelcomeLabel1, WelcomeLabel2, FinishedLabel, FinishedHeadingLabel: TLabel;
PageNameLabel: TLabel;

procedure InitializeWizard();
begin
WizardForm.BackButton.Width:=ButtonWidth
WizardForm.BackButton.Height:=ButtonHeight
WizardForm.NextButton.Width:=ButtonWidth
WizardForm.NextButton.Height:=ButtonHeight
WizardForm.CancelButton.Width:=ButtonWidth
WizardForm.CancelButton.Height:=ButtonHeight
WizardForm.DirBrowseButton.Left:=337
WizardForm.DirBrowseButton.Width:=ButtonWidth
WizardForm.DirBrowseButton.Height:=ButtonHeight
WizardForm.GroupBrowseButton.Left:=337
WizardForm.GroupBrowseButton.Width:=ButtonWidth
WizardForm.GroupBrowseButton.Height:=ButtonHeight

WizardForm.LicenseAcceptedRadio.OnClick:=@LicenceAcceptedRadioOnClick
WizardForm.LicenseNotAcceptedRadio.OnClick:=@LicenceNotAcceptedRadioOnClick

ExtractTemporaryFile('button.bmp')
LoadButtonImage(WizardForm.BackButton,bidBack)
LoadButtonImage(WizardForm.NextButton,bidNext)
LoadButtonImage(WizardForm.CancelButton,bidCancel)
LoadButtonImage(WizardForm.DirBrowseButton,bidDirBrowse)
LoadButtonImage(WizardForm.GroupBrowseButton,bidGroupBrowse)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ExtractTemporaryFile('papka.bmp');
WizardForm.SelectDirBitmapImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\papka.bmp'));
WizardForm.SelectDirBitmapImage.AutoSize:=True;
WizardForm.SelectGroupBitmapImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\papka.bmp'));
WizardForm.SelectGroupBitmapImage.AutoSize:=True;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
WizardForm.Font.Color:=clWhite;
WizardForm.Color:=Color;
WizardForm.WelcomePage.Color:=Color;
WizardForm.InnerPage.Color:=Color;
WizardForm.FinishedPage.Color:=Color;
WizardForm.LicensePage.Color:=Color;
WizardForm.PasswordPage.Color:=Color;
WizardForm.InfoBeforePage.Color:=Color;
WizardForm.UserInfoPage.Color:=Color;
WizardForm.SelectDirPage.Color:=Color;
WizardForm.SelectComponentsPage.Color:=Color;
WizardForm.SelectProgramGroupPage.Color:=Color;
WizardForm.SelectTasksPage.Color:=Color;
WizardForm.ReadyPage.Color:=Color;
WizardForm.PreparingPage.Color:=Color;
WizardForm.InstallingPage.Color:=Color;
WizardForm.InfoAfterPage.Color:=Color;
WizardForm.DirEdit.Color:=Color;
WizardForm.DiskSpaceLabel.Color:=Color;
WizardForm.DirEdit.Color:=Color;
WizardForm.GroupEdit.Color:=Color;
WizardForm.PasswordLabel.Color:=Color;
WizardForm.PasswordEdit.Color:=Color;
WizardForm.PasswordEditLabel.Color:=Color;
WizardForm.ReadyMemo.Color:=Color;
WizardForm.TypesCombo.Color:=Color;
WizardForm.WelcomeLabel1.Color:=Color;
WizardForm.InfoBeforeClickLabel.Color:=Color;
WizardForm.MainPanel.Color:=Color;
WizardForm.PageNameLabel.Color:=Color;
WizardForm.PageDescriptionLabel.Color:=Color;
WizardForm.ReadyLabel.Color:=Color;
WizardForm.FinishedLabel.Color:=Color;
WizardForm.YesRadio.Color:=Color;
WizardForm.NoRadio.Color:=Color;
WizardForm.WelcomeLabel2.Color:=Color;
WizardForm.LicenseLabel1.Color:=Color;
WizardForm.InfoAfterClickLabel.Color:=Color;
WizardForm.ComponentsList.Color:=Color;
WizardForm.ComponentsDiskSpaceLabel.Color:=Color;
WizardForm.BeveledLabel.Color:=Color;
WizardForm.StatusLabel.Color:=Color;
WizardForm.FilenameLabel.Color:=Color;
WizardForm.SelectDirLabel.Color:=Color;
WizardForm.SelectStartMenuFolderLabel.Color:=Color;
WizardForm.SelectComponentsLabel.Color:=Color;
WizardForm.SelectTasksLabel.Color:=Color;
WizardForm.LicenseAcceptedRadio.Color:=Color;
WizardForm.LicenseNotAcceptedRadio.Color:=Color;
WizardForm.UserInfoNameLabel.Color:=Color;
WizardForm.UserInfoNameEdit.Color:=Color;
WizardForm.UserInfoOrgLabel.Color:=Color;
WizardForm.UserInfoOrgEdit.Color:=Color;
WizardForm.PreparingLabel.Color:=Color;
WizardForm.FinishedHeadingLabel.Color:=Color;
WizardForm.UserInfoSerialLabel.Color:=Color;
WizardForm.UserInfoSerialEdit.Color:=Color;
WizardForm.TasksList.Color:=Color;
WizardForm.RunList.Color:=Color;
WizardForm.SelectDirBrowseLabel.Color:=Color;
WizardForm.SelectStartMenuFolderBrowseLabel.Color:=Color;
//////////////////////////////////////////////////////////////////////////////////////////////////////
WizardForm.WizardBitmapImage.Width:= ScaleX(497);
WizardForm.WizardBitmapImage2.Width:= ScaleX(497);
WizardForm.WizardSmallBitmapImage.SetBounds(ScaleX(0), ScaleY(0), WizardForm.MainPanel.Width, WizardForm.MainPanel.Height);

WelcomeLabel1:= TLabel.Create(WizardForm);
WelcomeLabel1.AutoSize:= False;
with WizardForm.WelcomeLabel1 do
WelcomeLabel1.SetBounds(ScaleX(240), ScaleY(20), ScaleX(230), ScaleY(200));
WelcomeLabel1.Font:= WizardForm.WelcomeLabel1.Font
WelcomeLabel1.Font.Color:= clWhite;
WelcomeLabel1.Transparent:= True;
WelcomeLabel1.WordWrap:= true;
WelcomeLabel1.Caption:= WizardForm.WelcomeLabel1.Caption;
WelcomeLabel1.Parent:= WizardForm.WelcomePage

WelcomeLabel2:= TLabel.Create(WizardForm);
WelcomeLabel2.AutoSize:= False;
with WizardForm.WelcomeLabel2 do
WelcomeLabel2.SetBounds(ScaleX(240), ScaleY(100), ScaleX(230), ScaleY(200));
WelcomeLabel2.Font:= WizardForm.WelcomeLabel2.Font
WelcomeLabel2.Font.Color:= clWhite;
WelcomeLabel2.Transparent:= True;
WelcomeLabel2.WordWrap:= true;
WelcomeLabel2.Caption:= WizardForm.WelcomeLabel2.Caption;
WelcomeLabel2.Parent:= WizardForm.WelcomePage

PageNameLabel:= TLabel.Create(WizardForm)
with WizardForm.PageNameLabel do
PageNameLabel.SetBounds(Left, Top, Width, Height);
PageNameLabel.Transparent:= True;
PageNameLabel.Font:= WizardForm.PageNameLabel.Font;
PageNameLabel.Font.Color:= clWhite;
PageNameLabel.Parent:= WizardForm.MainPanel;

FinishedHeadingLabel:= TLabel.Create(WizardForm);
FinishedHeadingLabel.AutoSize:= False;
with WizardForm.FinishedHeadingLabel do
FinishedHeadingLabel.SetBounds(ScaleX(240), ScaleY(20), ScaleX(230), ScaleY(200));
FinishedHeadingLabel.Font:= WizardForm.FinishedHeadingLabel.Font
FinishedHeadingLabel.Font.Color:= clWhite;
FinishedHeadingLabel.Transparent:= True;
FinishedHeadingLabel.WordWrap:= true;
FinishedHeadingLabel.Caption:= WizardForm.FinishedHeadingLabel.Caption;
FinishedHeadingLabel.Parent:= WizardForm.FinishedPage

FinishedLabel:= TLabel.Create(WizardForm);
FinishedLabel.AutoSize:= False;
with WizardForm.FinishedLabel do
FinishedLabel.SetBounds(ScaleX(240), ScaleY(100), ScaleX(230), ScaleY(220));
FinishedLabel.Font:= WizardForm.FinishedLabel.Font
FinishedLabel.Font.Color:= clWhite;
FinishedLabel.Transparent:= True;
FinishedLabel.WordWrap:= true;
FinishedLabel.Caption:= WizardForm.FinishedLabel.Caption;
FinishedLabel.Parent:= WizardForm.FinishedPage

WizardForm.WelcomeLabel1.Hide;
WizardForm.WelcomeLabel2.Hide;
WizardForm.PageNameLabel.Hide;
WizardForm.PageDescriptionLabel.Hide;
WizardForm.FinishedLabel.Hide;
WizardForm.FinishedHeadingLabel.Hide;
end;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure CurPageChanged(CurPageID: Integer);
begin
UpdateButton(WizardForm.BackButton,bidBack)
UpdateButton(WizardForm.NextButton,bidNext)
UpdateButton(WizardForm.CancelButton,bidCancel)
PageNameLabel.Caption:= WizardForm.PageNameLabel.Caption;
FinishedLabel.Caption:= WizardForm.FinishedLabel.Caption;
end;

saurn
25-05-2013, 18:17
wertulll
#define MyAppName "S.T.A.L.K.E.R. Зов Припяти"
#define AppVerName "S.T.A.L.K.E.R. Зов Припяти"
#define MyAppExeName "MyProg.exe"
#define NeedSize "5000000000"

#define NeedMem 512

#define SecondProgressBar

;#define Components

;#define records

;#define facompress

;#define PrecompInside
;#define SrepInside
;#define MSCInside
;#define precomp "0.42"
;#define unrar
;#define XDelta
;#define PackZIP

[Setup]
AppName={#MyAppName}
AppVerName={#AppVerName}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
WizardImageFile=Files\WizardImage.bmp
WizardSmallImageFile=Files\WizardSmallImage.bmp
OutputDir=...
#ifdef NeedSize
ExtraDiskSpaceRequired={#NeedSize}
#endif

[Languages]
Name: russian; MessagesFile: Files\Russian.isl

#ifdef Components
[Types]
Name: full; Description: Full installation; Flags: iscustom

[Components]
Name: text; Description: Язык субтитров; Types: full; Flags: fixed
Name: text\rus; Description: Русский; Flags: exclusive; ExtraDiskSpaceRequired: 100000000
Name: text\eng; Description: Английский; Flags: exclusive; ExtraDiskSpaceRequired: 200000000
Name: voice; Description: Язык озвучки; Types: full; Flags: fixed
Name: voice\rus; Description: Русский; Flags: exclusive; ExtraDiskSpaceRequired: 500000000
Name: voice\eng; Description: Английский; Flags: exclusive; ExtraDiskSpaceRequired: 600000000
#endif

[Tasks]
Name: desktopicon; Description: Создать значок на Рабочем столе; GroupDescription: Дополнительные значки:

[Files]
Source: Files\*; Flags: dontcopy
Source: Include\English.ini; DestDir: {tmp}; Flags: dontcopy
Source: Include\unarc.dll; DestDir: {tmp}; Flags: dontcopy
Source: ISDone.dll; DestDir: {tmp}; Flags: dontcopy
#ifdef records
Source: records.inf; DestDir: {tmp}; Flags: dontcopy
#endif

#ifdef PrecompInside
Source: Include\CLS-precomp.dll; DestDir: {tmp}; Flags: dontcopy
Source: Include\packjpg_dll.dll; DestDir: {tmp}; Flags: dontcopy
Source: Include\packjpg_dll1.dll; DestDir: {tmp}; Flags: dontcopy
Source: Include\precomp.exe; DestDir: {tmp}; Flags: dontcopy
Source: Include\zlib1.dll; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef SrepInside
Source: Include\CLS-srep.dll; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef MSCInside
Source: Include\CLS-MSC.dll; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef facompress
Source: Include\facompress.dll; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef precomp
#if precomp == "0.38"
Source: Include\precomp038.exe; DestDir: {tmp}; Flags: dontcopy
#else
#if precomp == "0.4"
Source: Include\precomp040.exe; DestDir: {tmp}; Flags: dontcopy
#else
#if precomp == "0.41"
Source: Include\precomp041.exe; DestDir: {tmp}; Flags: dontcopy
#else
#if precomp == "0.42"
Source: Include\precomp042.exe; DestDir: {tmp}; Flags: dontcopy
#else
Source: Include\precomp038.exe; DestDir: {tmp}; Flags: dontcopy
Source: Include\precomp040.exe; DestDir: {tmp}; Flags: dontcopy
Source: Include\precomp041.exe; DestDir: {tmp}; Flags: dontcopy
Source: Include\precomp042.exe; DestDir: {tmp}; Flags: dontcopy
#endif
#endif
#endif
#endif
#endif
#ifdef unrar
Source: Include\Unrar.dll; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef XDelta
Source: Include\XDelta3.dll; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef PackZIP
Source: Include\7z.dll; DestDir: {tmp}; Flags: dontcopy
Source: Include\packZIP.exe; DestDir: {tmp}; Flags: dontcopy
#endif

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon

[CustomMessages]
russian.ExtractedFile=Извлекается файл:
russian.Extracted=Распаковка архивов...
russian.CancelButton=Отменить распаковку
russian.Error=Ошибка распаковки!
russian.ElapsedTime=Прошло:
russian.RemainingTime=Осталось времени:
russian.EstimatedTime=Всего:
russian.AllElapsedTime=Время установки:

[code]
const
Color = clblack;
ButtonWidth = 80;
ButtonHeight = 23;
PCFonFLY=true;
notPCFonFLY=false;

bidBack = 0;
bidNext = 1;
bidCancel = 2;
bidDirBrowse = 3;
bidGroupBrowse = 4;

type
TCallback = function (OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAnsiChar): longword;

var
ButtonPanel: array [0..4] of TPanel;
ButtonImage: array [0..4] of TBitmapImage;
ButtonLabel: array [0..4] of TLabel;

LabelPct1,LabelCurrFileName,LabelTime1,LabelTime2,LabelTime3: TLabel;
ISDoneProgressBar1: TNewProgressBar;
#ifdef SecondProgressBar
LabelPct2: TLabel;
ISDoneProgressBar2:TNewProgressBar;
#endif
MyCancelButton: TButton;
ISDoneCancel:integer;
ISDoneError:boolean;
PCFVer:double;

function WrapCallback(callback:TCallback; paramcount:integer):longword;external 'wrapcallback@files:ISDone.dll stdcall delayload';

function ISArcExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutPath, ExtractedPath: AnsiString; DeleteInFile:boolean; Password, CfgFile, WorkPath: AnsiString; ExtractPCF: boolean ):boolean; external 'ISArcExtract@files:ISDone.dll stdcall delayload';
function IS7ZipExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutPath: AnsiString; DeleteInFile:boolean; Password: AnsiString):boolean; external 'IS7zipExtract@files:ISDone.dll stdcall delayload';
function ISRarExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutPath: AnsiString; DeleteInFile:boolean; Password: AnsiString):boolean; external 'ISRarExtract@files:ISDone.dll stdcall delayload';
function ISPrecompExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutFile: AnsiString; DeleteInFile:boolean):boolean; external 'ISPrecompExtract@files:ISDone.dll stdcall delayload';
function ISSRepExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutFile: AnsiString; DeleteInFile:boolean):boolean; external 'ISSrepExtract@files:ISDone.dll stdcall delayload';
function ISxDeltaExtract(CurComponent:Cardinal; PctOfTotal:double; minRAM,maxRAM:integer; InName, DiffFile, OutFile: AnsiString; DeleteInFile, DeleteDiffFile:boolean):boolean; external 'ISxDeltaExtract@files:ISDone.dll stdcall delayload';
function ISPackZIP(CurComponent:Cardinal; PctOfTotal:double; InName, OutFile: AnsiString;ComprLvl:integer; DeleteInFile:boolean):boolean; external 'ISPackZIP@files:ISDone.dll stdcall delayload';
function ShowChangeDiskWindow(Text, DefaultPath, SearchFile:AnsiString):boolean; external 'ShowChangeDiskWindow@files:ISDone.dll stdcall delayload';

function Exec2 (FileName, Param: PAnsiChar;Show:boolean):boolean; external 'Exec2@files:ISDone.dll stdcall delayload';
function ISFindFiles(CurComponent:Cardinal; FileMask:AnsiString; var ColFiles:integer):integer; external 'ISFindFiles@files:ISDone.dll stdcall delayload';
function ISPickFilename(FindHandle:integer; OutPath:AnsiString; var CurIndex:integer; DeleteInFile:boolean):boolean; external 'ISPickFilename@files:ISDone.dll stdcall delayload';
function ISGetName(TypeStr:integer):PAnsichar; external 'ISGetName@files:ISDone.dll stdcall delayload';
function ISFindFree(FindHandle:integer):boolean; external 'ISFindFree@files:ISDone.dll stdcall delayload';
function ISExec(CurComponent:Cardinal; PctOfTotal,SpecifiedProcessTime:double; ExeName,Parameters,TargetDir,OutputStr:AnsiString;Show:boolean):boolean; external 'ISExec@files:ISDone.dll stdcall delayload';

function SrepInit(TmpPath:PAnsiChar;VirtMem,MaxSave:Cardinal):boolean; external 'SrepInit@files:ISDone.dll stdcall delayload';
function PrecompInit(TmpPath:PAnsiChar;VirtMem:cardinal;PrecompVers:single):boolean; external 'PrecompInit@files:ISDone.dll stdcall delayload';
function FileSearchInit(RecursiveSubDir:boolean):boolean; external 'FileSearchInit@files:ISDone.dll stdcall delayload';
function ISDoneInit(RecordFileName:AnsiString; TimeType,Comp1,Comp2,Comp3:Cardinal; WinHandle, NeededMem:longint; callback:TCallback):boolean; external 'ISDoneInit@files:ISDone.dll stdcall';
function ISDoneStop:boolean; external 'ISDoneStop@files:ISDone.dll stdcall';
function ChangeLanguage(Language:AnsiString):boolean; external 'ChangeLanguage@files:ISDone.dll stdcall delayload';
function SuspendProc:boolean; external 'SuspendProc@files:ISDone.dll stdcall';
function ResumeProc:boolean; external 'ResumeProc@files:ISDone.dll stdcall';

function ProgressCallback(OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAnsiChar): longword;
begin
if OveralPct<=1000 then ISDoneProgressBar1.Position := OveralPct;
LabelPct1.Caption := IntToStr(OveralPct div 10)+'.'+chr(48 + OveralPct mod 10)+'%';
#ifdef SecondProgressBar
if CurrentPct<=1000 then ISDoneProgressBar2.Position := CurrentPct;
LabelPct2.Caption := IntToStr(CurrentPct div 10)+'.'+chr(48 + CurrentPct mod 10)+'%';
#endif
LabelCurrFileName.Caption:=ExpandConstant('{cm:ExtractedFile} ')+MinimizePathName(CurrentFile, LabelCurrFileName.Font, LabelCurrFileName.Width-ScaleX(100));
LabelTime1.Caption:=ExpandConstant('{cm:ElapsedTime} ')+TimeStr2;
LabelTime2.Caption:=ExpandConstant('{cm:RemainingTime} ')+TimeStr1;
LabelTime3.Caption:=ExpandConstant('{cm:AllElapsedTime}')+TimeStr3;
Result := ISDoneCancel;
end;

procedure CancelButtonOnClick(Sender: TObject);
begin
SuspendProc;
if MsgBox(SetupMessage(msgExitSetupMessage), mbConfirmation, MB_YESNO) = IDYES then ISDoneCancel:=1;
ResumeProc;
end;

procedure HideControls;
begin
WizardForm.FileNamelabel.Hide;
ISDoneProgressBar1.Hide;
LabelPct1.Hide;
LabelCurrFileName.Hide;
LabelTime1.Hide;
LabelTime2.Hide;
MyCancelButton.Hide;
#ifdef SecondProgressBar
ISDoneProgressBar2.Hide;
LabelPct2.Hide;
#endif
end;

procedure CreateControls;
var PBTop:integer;
begin
PBTop:=ScaleY(50);
ISDoneProgressBar1 := TNewProgressBar.Create(WizardForm);
with ISDoneProgressBar1 do begin
Parent := WizardForm.InstallingPage;
Height := WizardForm.ProgressGauge.Height;
Left := ScaleX(0);
Top := PBTop;
Width := ScaleX(365);
Max := 1000;
end;
LabelPct1 := TLabel.Create(WizardForm);
with LabelPct1 do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
Left := ISDoneProgressBar1.Width+ScaleX(5);
Top := ISDoneProgressBar1.Top + ScaleY(2);
Width := ScaleX(80);
end;
LabelCurrFileName := TLabel.Create(WizardForm);
with LabelCurrFileName do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
Width := ISDoneProgressBar1.Width+ScaleX(30);
Left := ScaleX(0);
Top := ScaleY(30);
end;
#ifdef SecondProgressBar
PBTop:=PBTop+ScaleY(25);
ISDoneProgressBar2 := TNewProgressBar.Create(WizardForm);
with ISDoneProgressBar2 do begin
Parent := WizardForm.InstallingPage;
Left := ScaleX(0);
Top := PBTop+ScaleY(8);
Width := ISDoneProgressBar1.Width;
Max := 1000;
Height := WizardForm.ProgressGauge.Height;
end;
LabelPct2 := TLabel.Create(WizardForm);
with LabelPct2 do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
Left := ISDoneProgressBar2.Width+ScaleX(5);
Top := ISDoneProgressBar2.Top + ScaleY(2);
Width := ScaleX(80);
end;
#endif
LabelTime1 := TLabel.Create(WizardForm);
with LabelTime1 do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
Width := ISDoneProgressBar1.Width div 2;
Left := ScaleX(0);
Top := PBTop + ScaleY(35);
end;
LabelTime2 := TLabel.Create(WizardForm);
with LabelTime2 do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
Width := LabelTime1.Width+ScaleX(40);
Left := ISDoneProgressBar1.Width div 2;
Top := LabelTime1.Top;
end;
LabelTime3 := TLabel.Create(WizardForm);
with LabelTime3 do begin
Parent := WizardForm.FinishedPage;
AutoSize := False;
Width := 300;
Left := 180;
Top := 200;
end;
MyCancelButton:=TButton.Create(WizardForm);
with MyCancelButton do begin
Parent:=WizardForm;
Width:=ScaleX(135);
Caption:=ExpandConstant('{cm:CancelButton}');
Left:=ScaleX(360);
Top:=WizardForm.cancelbutton.top;
OnClick:=@CancelButtonOnClick;
end;
end;

procedure ButtonLabelClick(Sender: TObject);
var
Button: TButton;
begin
ButtonImage[TLabel(Sender).Tag].Left:=0
case TLabel(Sender).Tag of
bidBack: Button:=WizardForm.BackButton
bidNext: Button:=WizardForm.NextButton
bidCancel: Button:=WizardForm.CancelButton
bidDirBrowse: Button:=WizardForm.DirBrowseButton
bidGroupBrowse: Button:=WizardForm.GroupBrowseButton
else
Exit
end;
Button.OnClick(Button)
end;

procedure ButtonLabelMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if ButtonLabel[TLabel(Sender).Tag].Enabled then
ButtonImage[TLabel(Sender).Tag].Left:=-ButtonWidth
end;

procedure ButtonLabelMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
ButtonImage[TLabel(Sender).Tag].Left:=0
end;

procedure LoadButtonImage(AButton: TButton; AButtonIndex: integer);
var
Image: TBitmapImage;
Panel: TPanel;
Labl: TLabel;

begin
Panel:=TPanel.Create(WizardForm)
Panel.Left:=AButton.Left
Panel.Top:=AButton.Top
Panel.Width:=AButton.Width
Panel.Height:=AButton.Height
Panel.Tag:=AButtonIndex
Panel.Parent:=AButton.Parent
ButtonPanel[AButtonIndex]:=Panel

Image:=TBitmapImage.Create(WizardForm)
Image.Width:=160
Image.Height:=23
Image.Enabled:=False
Image.Bitmap.LoadFromFile(ExpandConstant('{tmp}\button.bmp'))
Image.Parent:=Panel
ButtonImage[AButtonIndex]:=Image


Labl:=TLabel.Create(WizardForm)
Labl.Top := 5
Labl.Width := Panel.Width
Labl.Height := Panel.Height
Labl.Autosize := False
Labl.Alignment := taCenter
Labl.Tag:=AButtonIndex
Labl.Enabled:= AButton.Enabled
Labl.Transparent:=True
Labl.Font.Color:=clWhite
Labl.Caption:=AButton.Caption
Labl.OnClick:=@ButtonLabelClick
Labl.OnDblClick:=@ButtonLabelClick
Labl.OnMouseDown:=@ButtonLabelMouseDown
Labl.OnMouseUp:=@ButtonLabelMouseUp
Labl.Parent:=Panel
ButtonLabel[AButtonIndex]:=Labl
end;

procedure UpdateButton(AButton: TButton;AButtonIndex: integer);
begin
ButtonLabel[AButtonIndex].Caption:=AButton.Caption
ButtonPanel[AButtonIndex].Visible:=AButton.Visible
ButtonLabel[AButtonIndex].Enabled:=Abutton.Enabled
end;

procedure LicenceAcceptedRadioOnClick(Sender: TObject);
begin
ButtonLabel[bidNext].Enabled:=True
end;

procedure LicenceNotAcceptedRadioOnClick(Sender: TObject);
begin
ButtonLabel[bidNext].Enabled:=False
end;

var
WelcomeLabel1, WelcomeLabel2, FinishedLabel, FinishedHeadingLabel: TLabel;
PageNameLabel: TLabel;

procedure InitializeWizard();
begin
WizardForm.BackButton.Width:=ButtonWidth
WizardForm.BackButton.Height:=ButtonHeight
WizardForm.NextButton.Width:=ButtonWidth
WizardForm.NextButton.Height:=ButtonHeight
WizardForm.CancelButton.Width:=ButtonWidth
WizardForm.CancelButton.Height:=ButtonHeight
WizardForm.DirBrowseButton.Left:=337
WizardForm.DirBrowseButton.Width:=ButtonWidth
WizardForm.DirBrowseButton.Height:=ButtonHeight
WizardForm.GroupBrowseButton.Left:=337
WizardForm.GroupBrowseButton.Width:=ButtonWidth
WizardForm.GroupBrowseButton.Height:=ButtonHeight

WizardForm.LicenseAcceptedRadio.OnClick:=@LicenceAcceptedRadioOnClick
WizardForm.LicenseNotAcceptedRadio.OnClick:=@LicenceNotAcceptedRadioOnClick

ExtractTemporaryFile('button.bmp')
LoadButtonImage(WizardForm.BackButton,bidBack)
LoadButtonImage(WizardForm.NextButton,bidNext)
LoadButtonImage(WizardForm.CancelButton,bidCancel)
LoadButtonImage(WizardForm.DirBrowseButton,bidDirBrowse)
LoadButtonImage(WizardForm.GroupBrowseButton,bidGroupBrowse)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ExtractTemporaryFile('papka.bmp');
WizardForm.SelectDirBitmapImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\papka.bmp'));
WizardForm.SelectDirBitmapImage.AutoSize:=True;
WizardForm.SelectGroupBitmapImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\papka.bmp'));
WizardForm.SelectGroupBitmapImage.AutoSize:=True;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
WizardForm.Font.Color:=clWhite;
WizardForm.Color:=Color;
WizardForm.WelcomePage.Color:=Color;
WizardForm.InnerPage.Color:=Color;
WizardForm.FinishedPage.Color:=Color;
WizardForm.LicensePage.Color:=Color;
WizardForm.PasswordPage.Color:=Color;
WizardForm.InfoBeforePage.Color:=Color;
WizardForm.UserInfoPage.Color:=Color;
WizardForm.SelectDirPage.Color:=Color;
WizardForm.SelectComponentsPage.Color:=Color;
WizardForm.SelectProgramGroupPage.Color:=Color;
WizardForm.SelectTasksPage.Color:=Color;
WizardForm.ReadyPage.Color:=Color;
WizardForm.PreparingPage.Color:=Color;
WizardForm.InstallingPage.Color:=Color;
WizardForm.InfoAfterPage.Color:=Color;
WizardForm.DirEdit.Color:=Color;
WizardForm.DiskSpaceLabel.Color:=Color;
WizardForm.DirEdit.Color:=Color;
WizardForm.GroupEdit.Color:=Color;
WizardForm.PasswordLabel.Color:=Color;
WizardForm.PasswordEdit.Color:=Color;
WizardForm.PasswordEditLabel.Color:=Color;
WizardForm.ReadyMemo.Color:=Color;
WizardForm.TypesCombo.Color:=Color;
WizardForm.WelcomeLabel1.Color:=Color;
WizardForm.InfoBeforeClickLabel.Color:=Color;
WizardForm.MainPanel.Color:=Color;
WizardForm.PageNameLabel.Color:=Color;
WizardForm.PageDescriptionLabel.Color:=Color;
WizardForm.ReadyLabel.Color:=Color;
WizardForm.FinishedLabel.Color:=Color;
WizardForm.YesRadio.Color:=Color;
WizardForm.NoRadio.Color:=Color;
WizardForm.WelcomeLabel2.Color:=Color;
WizardForm.LicenseLabel1.Color:=Color;
WizardForm.InfoAfterClickLabel.Color:=Color;
WizardForm.ComponentsList.Color:=Color;
WizardForm.ComponentsDiskSpaceLabel.Color:=Color;
WizardForm.BeveledLabel.Color:=Color;
WizardForm.StatusLabel.Color:=Color;
WizardForm.FilenameLabel.Color:=Color;
WizardForm.SelectDirLabel.Color:=Color;
WizardForm.SelectStartMenuFolderLabel.Color:=Color;
WizardForm.SelectComponentsLabel.Color:=Color;
WizardForm.SelectTasksLabel.Color:=Color;
WizardForm.LicenseAcceptedRadio.Color:=Color;
WizardForm.LicenseNotAcceptedRadio.Color:=Color;
WizardForm.UserInfoNameLabel.Color:=Color;
WizardForm.UserInfoNameEdit.Color:=Color;
WizardForm.UserInfoOrgLabel.Color:=Color;
WizardForm.UserInfoOrgEdit.Color:=Color;
WizardForm.PreparingLabel.Color:=Color;
WizardForm.FinishedHeadingLabel.Color:=Color;
WizardForm.UserInfoSerialLabel.Color:=Color;
WizardForm.UserInfoSerialEdit.Color:=Color;
WizardForm.TasksList.Color:=Color;
WizardForm.RunList.Color:=Color;
WizardForm.SelectDirBrowseLabel.Color:=Color;
WizardForm.SelectStartMenuFolderBrowseLabel.Color:=Color;
//////////////////////////////////////////////////////////////////////////////////////////////////////
WizardForm.WizardBitmapImage.Width:= ScaleX(497);
WizardForm.WizardBitmapImage2.Width:= ScaleX(497);
WizardForm.WizardSmallBitmapImage.SetBounds(ScaleX(0), ScaleY(0), WizardForm.MainPanel.Width, WizardForm.MainPanel.Height);

WelcomeLabel1:= TLabel.Create(WizardForm);
WelcomeLabel1.AutoSize:= False;
with WizardForm.WelcomeLabel1 do
WelcomeLabel1.SetBounds(ScaleX(240), ScaleY(20), ScaleX(230), ScaleY(200));
WelcomeLabel1.Font:= WizardForm.WelcomeLabel1.Font
WelcomeLabel1.Font.Color:= clWhite;
WelcomeLabel1.Transparent:= True;
WelcomeLabel1.WordWrap:= true;
WelcomeLabel1.Caption:= WizardForm.WelcomeLabel1.Caption;
WelcomeLabel1.Parent:= WizardForm.WelcomePage

WelcomeLabel2:= TLabel.Create(WizardForm);
WelcomeLabel2.AutoSize:= False;
with WizardForm.WelcomeLabel2 do
WelcomeLabel2.SetBounds(ScaleX(240), ScaleY(100), ScaleX(230), ScaleY(200));
WelcomeLabel2.Font:= WizardForm.WelcomeLabel2.Font
WelcomeLabel2.Font.Color:= clWhite;
WelcomeLabel2.Transparent:= True;
WelcomeLabel2.WordWrap:= true;
WelcomeLabel2.Caption:= WizardForm.WelcomeLabel2.Caption;
WelcomeLabel2.Parent:= WizardForm.WelcomePage

PageNameLabel:= TLabel.Create(WizardForm)
with WizardForm.PageNameLabel do
PageNameLabel.SetBounds(Left, Top, Width, Height);
PageNameLabel.Transparent:= True;
PageNameLabel.Font:= WizardForm.PageNameLabel.Font;
PageNameLabel.Font.Color:= clWhite;
PageNameLabel.Parent:= WizardForm.MainPanel;

FinishedHeadingLabel:= TLabel.Create(WizardForm);
FinishedHeadingLabel.AutoSize:= False;
with WizardForm.FinishedHeadingLabel do
FinishedHeadingLabel.SetBounds(ScaleX(240), ScaleY(20), ScaleX(230), ScaleY(200));
FinishedHeadingLabel.Font:= WizardForm.FinishedHeadingLabel.Font
FinishedHeadingLabel.Font.Color:= clWhite;
FinishedHeadingLabel.Transparent:= True;
FinishedHeadingLabel.WordWrap:= true;
FinishedHeadingLabel.Caption:= WizardForm.FinishedHeadingLabel.Caption;
FinishedHeadingLabel.Parent:= WizardForm.FinishedPage

FinishedLabel:= TLabel.Create(WizardForm);
FinishedLabel.AutoSize:= False;
with WizardForm.FinishedLabel do
FinishedLabel.SetBounds(ScaleX(240), ScaleY(100), ScaleX(230), ScaleY(220));
FinishedLabel.Font:= WizardForm.FinishedLabel.Font
FinishedLabel.Font.Color:= clWhite;
FinishedLabel.Transparent:= True;
FinishedLabel.WordWrap:= true;
FinishedLabel.Caption:= WizardForm.FinishedLabel.Caption;
FinishedLabel.Parent:= WizardForm.FinishedPage

WizardForm.WelcomeLabel1.Hide;
WizardForm.WelcomeLabel2.Hide;
WizardForm.PageNameLabel.Hide;
WizardForm.PageDescriptionLabel.Hide;
WizardForm.FinishedLabel.Hide;
WizardForm.FinishedHeadingLabel.Hide;
end;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure CurPageChanged(CurPageID: Integer);
begin
UpdateButton(WizardForm.BackButton,bidBack)
UpdateButton(WizardForm.NextButton,bidNext)
UpdateButton(WizardForm.CancelButton,bidCancel)
PageNameLabel.Caption:= WizardForm.PageNameLabel.Caption;
FinishedLabel.Caption:= WizardForm.FinishedLabel.Caption;
if (CurPageID = wpFinished) and ISDoneError then
begin
LabelTime3.Hide;
WizardForm.Caption:= ExpandConstant('{cm:Error}');
WizardForm.FinishedLabel.Font.Color:= clRed;
WizardForm.FinishedLabel.Caption:= SetupMessage(msgSetupAborted) ;
end;
end;

function CheckError:boolean;
begin
result:= not ISDoneError;
end;

procedure CurStepChanged(CurStep: TSetupStep);
var Comps1,Comps2,Comps3, TmpValue:cardinal;
FindHandle1,ColFiles1,CurIndex1,tmp:integer;
ExecError:boolean;
InFilePath,OutFilePath,OutFileName:PAnsiChar;
begin
if CurStep = ssInstall then begin //Если необходимо, можно поменять на ssPostInstall
WizardForm.ProgressGauge.Hide;
WizardForm.CancelButton.Hide;
CreateControls;
WizardForm.StatusLabel.Caption:=ExpandConstant('{cm:Extracted}');
ISDoneCancel:=0;

// Распаковка всех необходимых файлов в папку {tmp}.

ExtractTemporaryFile('unarc.dll');

#ifdef PrecompInside
ExtractTemporaryFile('CLS-precomp.dll');
ExtractTemporaryFile('packjpg_dll.dll');
ExtractTemporaryFile('packjpg_dll1.dll');
ExtractTemporaryFile('precomp.exe');
ExtractTemporaryFile('zlib1.dll');
#endif
#ifdef SrepInside
ExtractTemporaryFile('CLS-srep.dll');
#endif
#ifdef MSCInside
ExtractTemporaryFile('CLS-MSC.dll');
#endif
#ifdef facompress
ExtractTemporaryFile('facompress.dll'); //ускоряет распаковку .arc архивов.
#endif
#ifdef records
ExtractTemporaryFile('records.inf');
#endif
#ifdef precomp
#if precomp == "0.38"
ExtractTemporaryFile('precomp038.exe');
#else
#if precomp == "0.4"
ExtractTemporaryFile('precomp040.exe');
#else
#if precomp == "0.41"
ExtractTemporaryFile('precomp041.exe');
#else
#if precomp == "0.42"
ExtractTemporaryFile('precomp042.exe');
#else
ExtractTemporaryFile('precomp038.exe');
ExtractTemporaryFile('precomp040.exe');
ExtractTemporaryFile('precomp041.exe');
ExtractTemporaryFile('precomp042.exe');
#endif
#endif
#endif
#endif
#endif
#ifdef unrar
ExtractTemporaryFile('Unrar.dll');
#endif
#ifdef XDelta
ExtractTemporaryFile('XDelta3.dll');
#endif
#ifdef PackZIP
ExtractTemporaryFile('7z.dll');
ExtractTemporaryFile('PackZIP.exe');
#endif

ExtractTemporaryFile('English.ini');

// Подготавливаем переменную, содержащую всю информацию о выделенных компонентах для ISDone.dll
// максимум 96 компонентов.
Comps1:=0; Comps2:=0; Comps3:=0;
#ifdef Components
TmpValue:=1;
if IsComponentSelected('text\rus') then Comps1:=Comps1+TmpValue; //компонент 1
TmpValue:=TmpValue*2;
if IsComponentSelected('text\eng') then Comps1:=Comps1+TmpValue; //компонент 2
TmpValue:=TmpValue*2;
if IsComponentSelected('voice\rus') then Comps1:=Comps1+TmpValue; //компонент 3
TmpValue:=TmpValue*2;
if IsComponentSelected('voice\eng') then Comps1:=Comps1+TmpValue; //компонент 4
// .....
// см. справку
#endif

#ifdef precomp
PCFVer:={#precomp};
#else
PCFVer:=0;
#endif
ISDoneError:=true;
if ISDoneInit(ExpandConstant('{src}\records.inf'), $F777, Comps1,Comps2,Comps3, MainForm.Handle, {#NeedMem}, @ProgressCallback) then begin
repeat
// ChangeLanguage('English');
if not SrepInit('',512,0) then break;
if not PrecompInit('',128,PCFVer) then break;
if not FileSearchInit(true) then break;

if not ISArcExtract ( 0, 0, ExpandConstant('{src}\*.arc'), ExpandConstant('{app}'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;

// далее находятся закомментированые примеры различных функций распаковки (чтобы каждый раз не лазить в справку за примерами)
(*
if not ISArcExtract ( 0, 0, ExpandConstant('{src}\arc.arc'), ExpandConstant('{app}\'), '', false, '', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
if not IS7ZipExtract ( 0, 0, ExpandConstant('{src}\CODMW2.7z'), ExpandConstant('{app}\data1'), false, '') then break;
if not ISRarExtract ( 0, 0, ExpandConstant('{src}\data_*.rar'), ExpandConstant('{app}'), false, '') then break;
if not ISSRepExtract ( 0, 0, ExpandConstant('{app}\data1024_1024.srep'),ExpandConstant('{app}\data1024.arc'), true) then break;
if not ISPrecompExtract( 0, 0, ExpandConstant('{app}\data.pcf'), ExpandConstant('{app}\data.7z'), true) then break;
if not ISxDeltaExtract ( 0, 0, 0, 640, ExpandConstant('{app}\in.pcf'), ExpandConstant('{app}\*.diff'), ExpandConstant('{app}\out.dat'), false, false) then break;
if not ISPackZIP ( 0, 0, ExpandConstant('{app}\1a1\*'), ExpandConstant('{app}\1a1.pak'), 2, false ) then break;
if not ISExec ( 0, 0, 0, ExpandConstant('{tmp}\Arc.exe'), ExpandConstant('x -o+ "{src}\001.arc" "{app}\"'), ExpandConstant('{tmp}'), '...',false) then break;
if not ShowChangeDiskWindow ('Пожалуйста, вставьте второй диск и дождитесь его инициализации.', ExpandConstant('{src}'),'CODMW_2.arc') then break;

// распаковка группы файлов посредством внешнего приложения

FindHandle1:=ISFindFiles(0,ExpandConstant('{app}\*.ogg'),ColFiles1);
ExecError:=false;
while not ExecError and ISPickFilename(FindHandle1,ExpandConstant('{app}\'),CurIndex1,true) do begin
InFilePath:=ISGetName(0);
OutFilePath:=ISGetName(1);
OutFileName:=ISGetName(2);
ExecError:=not ISExec(0, 0, 0, ExpandConstant('{tmp}\oggdec.exe'), '"'+InFilePath+'" -w "'+OutFilePath+'"',ExpandConstant('{tmp}'),OutFileName,false);
end;
ISFindFree(FindHandle1);
if ExecError then break;
*)

ISDoneError:=false;
until true;
ISDoneStop;
end;
HideControls;
WizardForm.CancelButton.Visible:=true;
WizardForm.CancelButton.Enabled:=false;
end;
if (CurStep=ssPostInstall) and ISDoneError then begin
Exec2(ExpandConstant('{uninstallexe}'), '/VERYSILENT', false);
end;
end;

neorom
25-05-2013, 22:16
Как сделать обводку у текста, допустим текст белый а обводка чёрная, всё перерыл, не где не нашёл и зделать тень (без добавления нового TLabel)
Вот участок кода:PageNameLabel := TLabel.Create(WizardForm);
with PageNameLabel do
begin
Left := ScaleX(45);
Top := ScaleY(10);
Width := ScaleX(300);
Height := ScaleY(14);
AutoSize := False;
WordWrap := True;
Font.Color := clwhite;
Font.Style := [fsBold];
Transparent := True;
Parent := WizardForm.MainPanel;
end;

Johny777
26-05-2013, 02:21
neorom,
без добавления нового TLabel (имитирующего тень) »
раз уж такое требование, то используй GDI графику или другими совами "рисуй на канве" (класс TCanvas, методы которого я советую изучить всем (хотя в инно они урезаны), кто их не знает. Пригодится!).
http://www.az-design.ru/index.shtml?Support&SoftWare&Delphi/D3/SB20

Пример:


const
TRANSPARENT = 1;

type
HDC = LongWord;

function SetBkMode(DC: HDC; BkMode: Integer): Integer; external 'SetBkMode@gdi32.dll stdcall';

procedure WizardFormOnPaint(Sender: TObject);
begin
with TWizardForm(Sender).Canvas do
begin
SetBKMode(Handle, TRANSPARENT);
Font.Name := 'Arial';
Font.Size := 48;
Font.Color := clBlack;
TextOut (14, 14, 'neorom');
Font.Color :=clRed;
TextOut (10, 10, 'neorom');
end;
end;

procedure InitializeWizard();
begin
WizardForm.OuterNotebook.Hide;
WizardForm.OnPaint := @WizardFormOnPaint;
end;


PS: это я портировал с делфи.

neorom
26-05-2013, 13:05
А как на счота обводки букв(текста) ?

Johny777
26-05-2013, 17:25
neorom,
А как на счота обводки букв(текста) ? »
Протировал с некоторыми изменениями и улучшениями отсюда http://www.cyberforum.ru/delphi-beginners/thread553467.html
теперь создание надписей через процедуры CreateTextWithBorder(...), CreateTextWithShadow(...), что намного практичнее и проще
что отправлять им в качестве аргументов понятно по названиям ссылок в заголовках и переменных в структуре _LITTLE_FONT_INFO
процедура CreateSquare(...) - бонус - создаёт прямоугольник. Кстати то что не умеет инно можно дополнить WinApi функциями из gdi32.dll. Пример такого подхода в шапке, в "создании кастомного чекбокса"
const
TRANSPARENT = 1;

STEAM_GREEN = $506a5a;


type
HDC = LongWord;

_LITTLE_FONT_INFO = record
Style: TFontStyles;
Size: Integer;
Name: String;
end;


function SetBkMode(DC: HDC; BkMode: Integer): Integer; external 'SetBkMode@gdi32.dll stdcall';


procedure CreateTextWithShadow(Canvas: TCanvas; const Text: String; const FontInfo: _LITTLE_FONT_INFO; const TextLeft, TextTop, TextColor, ShadowColor, ShadowLeft, ShadowTop: Integer);
begin
with Canvas do
begin
Font.Color := ShadowColor;
Font.Size := FontInfo.Size;
Font.Name := FontInfo.Name;
Font.Style := FontInfo.Style;
TextOut(TextLeft + ShadowLeft, TextTop + ShadowTop, Text);
Font.Color := TextColor;
TextOut(TextLeft, TextTop, Text);
end;
end;


procedure CreateTextWithBorder(Canvas: TCanvas; const Text: String; const FontInfo: _LITTLE_FONT_INFO; const TextLeft, TextTop, TextColor, ShadowColor, BorderWidth: Integer);
begin
with Canvas do
begin
Font.Color := ShadowColor;
Font.Size := FontInfo.Size;
Font.Name := FontInfo.Name;
Font.Style := FontInfo.Style;
TextOut(TextLeft + BorderWidth, TextTop + BorderWidth, Text);
TextOut(TextLeft - BorderWidth, TextTop - BorderWidth, Text);
TextOut(TextLeft + BorderWidth, TextTop - BorderWidth, Text);
TextOut(TextLeft - BorderWidth, TextTop + BorderWidth, Text);
Canvas.Font.Color := TextColor;
TextOut(TextLeft, TextTop, Text);
end;
end;


procedure CreateSquare(Canvas: TCanvas; const Left, Top, Width, Height, BorderWidth, BorderColor: Integer);
begin
with Canvas do
begin
Pen.Color := BorderColor;
Pen.Width := BorderWidth;
MoveTo(Left, Top);
LineTo(Left, Top + Height);
LineTo(Left + Width, Top + Height);
LineTo(Left + Width, Top);
LineTo(Top, Left);
end;
end;


procedure WizardFormOnPaint(Sender: TObject);
var
lfi: _LITTLE_FONT_INFO;
begin
SetBKMode(TWizardForm(Sender).Canvas.Handle, TRANSPARENT);

lfi.Style := [fsBold];
lfi.Size := 54;
lfi.Name := 'Tahoma';
CreateTextWithBorder(TWizardForm(Sender).Canvas, 'VALVE', lfi, ScaleX(16), ScaleY(16), clBlack, clWhite, 1);

lfi.Style := [];
lfi.Size := 24;
lfi.Name := 'Arial';
CreateTextWithShadow(TWizardForm(Sender).Canvas, 'VALVE', lfi, ScaleX(127), ScaleY(77), clWhite, clBlack, 4, 3);

CreateSquare(TWizardForm(Sender).Canvas, ScaleX(5), ScaleY(5), ScaleX(300), ScaleY(120), 1, clWhite);
end;


procedure InitializeWizard();
begin
WizardForm.Color := STEAM_GREEN;
WizardForm.OuterNotebook.Hide;
WizardForm.OnPaint := @WizardFormOnPaint;
end;

скрин:
http://img822.imageshack.us/img822/5917/96489319.png (http://imageshack.us/photo/my-images/822/96489319.png/)

neorom
27-05-2013, 09:54
Уважаэмий Johny777 прошу вас виложить отдельно скрипт для тени текста, и скрипт для обводки текста бо у меня их розєденить чтото не получаэться ( и чтоби текст VALVE отображался на странице вибора папкм установки). Спасибо.

Johny777
28-05-2013, 00:33
neorom, и скрипт для обводки текста бо у меня их розєденить чтото не получаэться »
да я вроде старался всё структурировано сделать. Ну да ладно, ведь ты говоришь:
и чтоби текст VALVE отображался на странице вибора папкм установки »
Тут проблема. Страница выбора директории это TNewNotebookPage и у неё и её предков нет подкласса TCanvas, а значит нарисовать тект на ней как в пред примере нге получится, разве что на вин апи, но мне сейчас туда нет времени лезть, поэтому предлагаю так: создавать на подобных Окнах TBitmapImage и рисовать на нём, а именно
TBitmapImage->TBitmap->TCanvas.
чтоб создать такой рисунок нужно много параметров и чтобы не получился километровый заголовок функции я написал свой тип = структура _BORDER_TEXT_STRUCT и _SHADOW_TEXT_STRUCT в соответствии для каждого примера. Всё работает предельно просто.
1. Мы объявляем ссылку на структуру
2. запоняем её (структуру)
3. отправляем в функцию и получаем на выходе старый добрый TBitmapImage, с которым умеет работать думаю каждый
как ты просил - два отдельных примера с комментариями
1-пример создания текста с тенью:
const
TRANSPARENT = 1;

type
HDC = LongWord;

function SetBkMode(DC: HDC; BkMode: Integer): Integer; external 'SetBkMode@gdi32.dll stdcall';

type
_SHADOW_TEXT_STRUCT = record
Parent: TWinControl; // родитель картинки
BackgroundColor: Integer; // цвет фона (катника получится прямоугольной. Поэтому всё, что в пределах прямоугольника, можно закрасить этим цветом перед тем как туда врисуется текст)
FontStyle: TFontStyles; // стиль шрафта (если ничего не приваивать, то будет стиль по-умолчанию)
FontSize: Integer; // размер шрифта (если ничего не приваивать, то будет размер шрифта по-умолчанию)
FontName: String; // имя шрифта (если ничего не приваивать (не рекомендую), то будет имя шрифта по-умолчанию)
ShadowColor: Integer; // цвет тени
ShadowLeft: Integer; // сдвиг тени относитьльно текста вправо
ShadowTop: Integer; // сдвиг тени относитьльно текста вниз
TextColor: Integer; // цвет текста
TextLeft: Integer; // расположение картинки слева
TextTop: Integer; // расположение картинки сверху
Text: String; // сам ткст
end;


procedure iColorRect(Canvas: TCanvas; const Color, Width, Height: Integer); /// private proc
var
rt: TRect;
begin
rt.Left := 0;
rt.Top := 0;
rt.Right := Width;
rt.Bottom := Height;
Canvas.Brush.Color := Color;
Canvas.FillRect(rt);
end;


function CreateBitmapShadowText(const st: _SHADOW_TEXT_STRUCT): TBitmapImage;
var
UndefWidth, UndefHeight: Integer;
begin
Result := TBitmapImage.Create( TComponent(st.Parent) ); // создаём картинку с указанием принадлежности
with Result do
begin
Parent := st.Parent; // назначаем родителя

with Bitmap.Canvas do
try // устанавливаем методам канвы спецификации шрифта чтоб чуть дальше методами канвы TextWidth и TextHeight получить требуемые размеры для отображения теста
Font.Color := st.ShadowColor;
Font.Size := st.FontSize;
Font.Name := st.FontName;
Font.Style := st.FontStyle;
finally // пишем значения размера текста в переменные, чтоб не гонять 2 раза методы TextWidth и TextHeight
UndefWidth := st.ShadowLeft + TextWidth(st.Text);
UndefHeight := st.ShadowTop + TextHeight(st.Text);
end;

SetBounds( ScaleX(st.TextLeft), ScaleY(st.TextTop), ScaleX(UndefWidth), ScaleY(UndefHeight) ); // устанвливаем размеры картинки

/// устанавливаем размеры подклассу картинки - битмапу
Bitmap.Width := ScaleX(UndefWidth);
Bitmap.Height := ScaleY(UndefHeight);

// запоняем весь битмап картинки цветом фона
iColorRect(Bitmap.Canvas, st.BackgroundColor, Width, Height);
// утанавливаем прозрачность канве
SetBKMode(Bitmap.Canvas.Handle, TRANSPARENT);

with Bitmap.Canvas do
begin
TextOut(0 + st.ShadowLeft, 0 + st.ShadowTop, st.Text); // рисуем текст-тень
Font.Color := st.TextColor; // меняем цвет шрифта
TextOut(0, 0, st.Text); // рисуем поверх тени тектс
end;
end;
end;



procedure InitializeWizard();
var
sts: _SHADOW_TEXT_STRUCT;
BitmapImage: TBitmapImage;
begin
sts.Parent := WizardForm.SelectDirPage;
sts.BackgroundColor := WizardForm.SelectDirPage.Color;
sts.FontStyle := [fsBold];
sts.FontSize := 44;
sts.FontName := 'Tahoma';
sts.ShadowColor := clBlack;
sts.ShadowLeft := 2;
sts.ShadowTop := 2;
sts.TextColor := clYellow;
sts.TextLeft := 10;
sts.TextTop := 100;
sts.Text := 'Valve';

BitmapImage := CreateBitmapShadowText(sts);
end;


2-пример создания текста с обводкой:
const
TRANSPARENT = 1;
STEAM_GREEN = $506a5a;

type
HDC = LongWord;

function SetBkMode(DC: HDC; BkMode: Integer): Integer; external 'SetBkMode@gdi32.dll stdcall';

type
_BORDER_TEXT_STRUCT = record
Parent: TWinControl; // родитель картинки
BackgroundColor: Integer; // цвет фона (катника получится прямоугольной. Поэтому всё, что в пределах прямоугольника, можно закрасить этим цветом перед тем как туда врисуется текст)
FontStyle: TFontStyles; // стиль шрафта (если ничего не приваивать, то будет стиль по-умолчанию)
FontSize: Integer; // размер шрифта (если ничего не приваивать, то будет размер шрифта по-умолчанию)
FontName: String; // имя шрифта (если ничего не приваивать (не рекомендую), то будет имя шрифта по-умолчанию)
BorderColor: Integer; // цвет обводки
BorderWidth: Integer; // ширина обводки
TextColor: Integer; // цвет текста
TextLeft: Integer; // расположение картинки слева
TextTop: Integer; // расположение картинки сверху
Text: String; // сам ткст
end;


procedure iColorRect(Canvas: TCanvas; const Color, Width, Height: Integer); /// private proc
var
rt: TRect;
begin
rt.Left := 0;
rt.Top := 0;
rt.Right := Width;
rt.Bottom := Height;
Canvas.Brush.Color := Color;
Canvas.FillRect(rt);
end;


function CreateBitmapBorderText(const bt: _BORDER_TEXT_STRUCT): TBitmapImage; // на выходе обычный TBitmapImage со всеми вытекающими возможностями
var
UndefWidth, UndefHeight: Integer;
begin
Result := TBitmapImage.Create( TComponent(bt.Parent) ); // создаём картинку с указанием принадлежности
with Result do
begin
Parent := bt.Parent; // назначаем родителя

with Bitmap.Canvas do
try // устанавливаем методам канвы спецификации шрифта чтоб чуть дальше методами канвы TextWidth и TextHeight получить требуемые размеры для отображения теста
Font.Color := bt.BorderColor;
Font.Size := bt.FontSize;
Font.Name := bt.FontName;
Font.Style := bt.FontStyle;
finally // пишем значения размера текста в переменные, чтоб не гонять 2 раза методы TextWidth и TextHeight
UndefWidth := TextWidth(bt.Text) + bt.BorderWidth*2;
UndefHeight := TextHeight(bt.Text) + bt.BorderWidth*2;
end;

SetBounds( ScaleX(bt.TextLeft+ bt.BorderWidth), ScaleY(bt.TextTop), ScaleX(UndefWidth), ScaleY(UndefHeight) ); // устанвливаем размеры картинки

/// устанавливаем размеры подклассу картинки - битмапу
Bitmap.Width := ScaleX(UndefWidth);
Bitmap.Height := ScaleY(UndefHeight);

// запоняем весь битмап картинки цветом фона
iColorRect(Bitmap.Canvas, bt.BackgroundColor, Width, Height);
// утанавливаем прозрачность канве
SetBKMode(Bitmap.Canvas.Handle, TRANSPARENT);

with Bitmap.Canvas do
begin
// рисуем обводку
TextOut(bt.BorderWidth*2, bt.BorderWidth*2, bt.Text);
TextOut(0, 0, bt.Text);
TextOut(bt.BorderWidth*2, 0, bt.Text);
TextOut(0, bt.BorderWidth*2, bt.Text);

Font.Color := bt.TextColor; // меняем цвет шрифта
TextOut(bt.BorderWidth, bt.BorderWidth, bt.Text); // рисуем поверх тени тектс
end;
end;
end;



procedure InitializeWizard();
var
bts: _BORDER_TEXT_STRUCT;
BitmapImage: TBitmapImage;
begin
bts.Parent := WizardForm.SelectDirPage;
bts.BackgroundColor := WizardForm.SelectDirPage.Color;
bts.FontStyle := [];
bts.FontSize := 44;
bts.FontName := 'Tahoma';
bts.BorderColor := clBlack;
bts.BorderWidth := 1;
bts.TextColor := STEAM_GREEN;
bts.TextLeft := 10;
bts.TextTop := 100;
bts.Text := 'Valve';

BitmapImage := CreateBitmapBorderText(bts);
end;


Внимание всем! Данный пример нужно использовать только в том случае, если у класса на котором хотите рисовать нет подкласса TCanvas, в противном случае лучше использвать пред. пример, тк он быстрее(хотя на глаз не видно:)). Хотя и у этого примера есть свой плюс - картинка на выходе.

==================================== UPD
разъединил предыдущий пример:

с тенью:
const
TRANSPARENT = 1;

STEAM_GREEN = $506a5a;


type
HDC = LongWord;

_LITTLE_FONT_INFO = record
Style: TFontStyles;
Size: Integer;
Name: String;
end;


function SetBkMode(DC: HDC; BkMode: Integer): Integer; external 'SetBkMode@gdi32.dll stdcall';


procedure CreateTextWithShadow(Canvas: TCanvas; const Text: String; const FontInfo: _LITTLE_FONT_INFO; const TextLeft, TextTop, TextColor, ShadowColor, ShadowLeft, ShadowTop: Integer);
begin
with Canvas do
begin
Font.Color := ShadowColor;
Font.Size := FontInfo.Size;
Font.Name := FontInfo.Name;
Font.Style := FontInfo.Style;
TextOut(TextLeft + ShadowLeft, TextTop + ShadowTop, Text);
Font.Color := TextColor;
TextOut(TextLeft, TextTop, Text);
end;
end;


procedure WizardFormOnPaint(Sender: TObject);
var
lfi: _LITTLE_FONT_INFO;
begin
SetBKMode(TWizardForm(Sender).Canvas.Handle, TRANSPARENT);

lfi.Style := [];
lfi.Size := 24;
lfi.Name := 'Arial';
CreateTextWithShadow(TWizardForm(Sender).Canvas, 'VALVE', lfi, ScaleX(127), ScaleY(77), clWhite, clBlack, 4, 3);
end;


procedure InitializeWizard();
begin
WizardForm.Color := STEAM_GREEN;
WizardForm.OuterNotebook.Hide;
WizardForm.OnPaint := @WizardFormOnPaint;
end;


с обводкой:
const
TRANSPARENT = 1;

STEAM_GREEN = $506a5a;


type
HDC = LongWord;

_LITTLE_FONT_INFO = record
Style: TFontStyles;
Size: Integer;
Name: String;
end;


function SetBkMode(DC: HDC; BkMode: Integer): Integer; external 'SetBkMode@gdi32.dll stdcall';


procedure CreateTextWithBorder(Canvas: TCanvas; const Text: String; const FontInfo: _LITTLE_FONT_INFO; const TextLeft, TextTop, TextColor, ShadowColor, BorderWidth: Integer);
begin
with Canvas do
begin
Font.Color := ShadowColor;
Font.Size := FontInfo.Size;
Font.Name := FontInfo.Name;
Font.Style := FontInfo.Style;
TextOut(TextLeft + BorderWidth, TextTop + BorderWidth, Text);
TextOut(TextLeft - BorderWidth, TextTop - BorderWidth, Text);
TextOut(TextLeft + BorderWidth, TextTop - BorderWidth, Text);
TextOut(TextLeft - BorderWidth, TextTop + BorderWidth, Text);
Canvas.Font.Color := TextColor;
TextOut(TextLeft, TextTop, Text);
end;
end;


procedure WizardFormOnPaint(Sender: TObject);
var
lfi: _LITTLE_FONT_INFO;
begin
SetBKMode(TWizardForm(Sender).Canvas.Handle, TRANSPARENT);

lfi.Style := [fsBold];
lfi.Size := 54;
lfi.Name := 'Tahoma';
CreateTextWithBorder(TWizardForm(Sender).Canvas, 'VALVE', lfi, ScaleX(16), ScaleY(16), clBlack, clWhite, 1);
end;


procedure InitializeWizard();
begin
WizardForm.Color := STEAM_GREEN;
WizardForm.OuterNotebook.Hide;
WizardForm.OnPaint := @WizardFormOnPaint;
end;



прямоугольник:
const
STEAM_GREEN = $506a5a;


type
HDC = LongWord;


function SetBkMode(DC: HDC; BkMode: Integer): Integer; external 'SetBkMode@gdi32.dll stdcall';


procedure CreateSquare(Canvas: TCanvas; const Left, Top, Width, Height, BorderWidth, BorderColor: Integer);
begin
with Canvas do
begin
Pen.Color := BorderColor;
Pen.Width := BorderWidth;
MoveTo(Left, Top);
LineTo(Left, Top + Height);
LineTo(Left + Width, Top + Height);
LineTo(Left + Width, Top);
LineTo(Top, Left);
end;
end;


procedure WizardFormOnPaint(Sender: TObject);
begin
CreateSquare(TWizardForm(Sender).Canvas, ScaleX(5), ScaleY(5), ScaleX(300), ScaleY(120), 1, clWhite);
end;


procedure InitializeWizard();
begin
WizardForm.Color := STEAM_GREEN;
WizardForm.OuterNotebook.Hide;
WizardForm.OnPaint := @WizardFormOnPaint;
end;




© OSzone.net 2001-2012