Показать полную графическую версию : Скрипты Inno Setup. Помощь и советы [часть 3]
Всем привет, ребята подскажите как можно настроить положение файликов для деинсталяции? Можно ли их запихнуть в папку с контентом ?
ILIA_1992
22-06-2011, 00:52
Сжал игру саботаж оригинал 6,7 гб ,сжал фриарком в 3,5гб.Чем можно сжатые файлы сжать,чтобы можно былоб сжать из 3,5 в 2,0
Посоветуйте прогу эффективную
murlakatamenka
22-06-2011, 01:24
Всем привет, ребята подскажите как можно настроить положение файликов для деинсталяции? Можно ли их запихнуть в папку с контентом ? »
[Setup]: UninstallFilesDir
Default value:
{app}
Description:
Specifies the directory where the "unins*.*" files for the uninstaller are stored.
Note: You should not assign a different value here on a new version of an application, or else Setup won't find the uninstall logs from the previous versions and therefore won't be able to append to them.
Example:
UninstallFilesDir={app}\uninst
перевод надо или и так понятно ? :)
murlakatamenka
22-06-2011, 02:22
Neutron, insombia, вот кое-что - http://rghost.ru/11910681
Gnom_aka_Lexander
22-06-2011, 11:20
Neutron, insombia, А вот (http://rghost.ru/9330061) более законченная версия того-же скрипта. Общий смысл понятен, изображения я там переделал более оптимально и так, не помню уж чего, по мелочи много. :)
Скажите, в инно есть предустановленная функция:
InfoBeforeFile=info\test.rtf
Можно ли сделать так, чтобы можно было показать еще один ридми-файл после него?
Gnom_aka_Lexander
22-06-2011, 13:59
leshcat, можно
[Setup]
AppName=My Application
AppVersion=1.5
DefaultDirName={pf}\My Application
[Files]
Source: Readme.rtf;Flags: dontcopy solidbreak noencryption ignoreversion;
[Code]
var
ISCustomPage1: TWizardPage;
RichEditViewer1: TRichEditViewer;
S: String;
procedure InitializeWizard();
begin
ExtracttemporaryFile('Readme.rtf')
LoadStringFromFile(ExpandConstant('{tmp}\Readme.rtf'),S);
{ Creates custom wizard page }
ISCustomPage1 := CreateCustomPage(wpInfoBefore, 'Ñòðàíèöà èíôîðìàöèè 2', 'Ïîæàëóéñòà. îçíàêîìüòåñü ñ èíôîðìàöèåé');
{ ISCustomPage1 }
with ISCustomPage1.Surface do
begin
Name := 'ISCustomPage1';
end;
{ RichEditViewer1 }
RichEditViewer1 := TRichEditViewer.Create(WizardForm);
with RichEditViewer1 do
begin
Name := 'RichEditViewer1';
Parent := ISCustomPage1.Surface;
Left := ScaleX(0);
Top := ScaleY(0);
Width := ScaleX(417);
Height := ScaleY(233);
RTFText :=S;
end;
end;
ILIA_1992
22-06-2011, 14:39
у кого-нибудь есть такой скрипт???
http://fastpic.ru/view/23/2011/0622/6896c271f4aba704f7a2f261a7a918b6.jpg.html
оч нужен
Gnom_aka_Lexander
22-06-2011, 15:05
ILIA_1992, это Need for Speed™ Undercover.iss v 2.2 из шапки этой темы с вырезанной статус-панелью
Лександер
Спасибо, работает! :)
insombia
22-06-2011, 20:33
Лександер ты как всегда помогаешь когда это нужно
Здравствуйте, помогите пожалуйста, почему на кнопки не ложится картинка в этом скрипте
[Setup]
AppId={{75562D30-F354-430A-96DA-A3FF701EB069}
AppName=My Program
AppVerName=My Program 1.5
AppPublisher=My Company, Inc.
AppPublisherURL=http://www.example.com/
AppSupportURL=http://www.example.com/
AppUpdatesURL=http://www.example.com/
DefaultDirName={pf}\My Program
DefaultGroupName=My Program
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
WizardImageFile=111.bmp
[Languages]
Name: "default"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked;
[Files]
Source: button.bmp; DestDir: {tmp}; 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}\My Program"; Filename: "{app}\MyProg.exe"
Name: "{commondesktop}\My Program"; Filename: "{app}\MyProg.exe"; Tasks: desktopicon
[Code]
const
ButtonWidth = 80; //Указываем размер кнопок
ButtonHeight = 23;
bidBack = 0;
bidNext = 1;
bidCancel = 2;
bidDirBrowse = 3;
bidGroupBrowse = 4;
var
pnl: TPanel;
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
with TLabel.Create(WizardForm) do begin
Tag:=AButtonIndex
Parent:=Panel
Width:=Panel.Width
Height:=Panel.Height
Transparent:=True
OnClick:=@ButtonLabelClick
OnDblClick:=@ButtonLabelClick
OnMouseDown:=@ButtonLabelMouseDown
OnMouseUp:=@ButtonLabelMouseUp
end
Labl:=TLabel.Create(WizardForm) //Текст кнопок
Labl.Left:=23 //Указываем положение текста
Labl.Top:=5
Labl.Autosize:=True
Labl.Alignment:=taCenter
Labl.Tag:=AButtonIndex
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;
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)
WizardForm.ClientWidth:=690
WizardForm.Bevel.Hide
WizardForm.Bevel1.Hide
end;
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:= clWhite;
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:= clWhite;
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;
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:= clWhite;
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:= clWhite;
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:= clWhite;
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:= clWhite;
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:= clWhite;
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:= clWhite;
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:= clWhite;
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:= clWhite;
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:= clWhite;
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:= clWhite;
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:= clWhite;
Style:= WizardForm.PageDescriptionLabel.Font.Style;
Name:= WizardForm.PageDescriptionLabel.Font.Name;
Size:= WizardForm.PageDescriptionLabel.Font.Size;
end;
Transparent:= True;
Parent:= pnl;
end;
pnl.Repaint;
UpdateButton(WizardForm.BackButton,bidBack)
UpdateButton(WizardForm.NextButton,bidNext)
UpdateButton(WizardForm.CancelButton,bidCancel)
end;
if CurPageID = wpWelcome then WelcomePage;
if CurPageID = wpSelectDir then SelectDirPage;
if CurPageID = wpReady then ReadyPage;
if CurPageID = wpInstalling then InstallingPage;
if CurPageID = wpFinished then FinishedPage;
end;
ILIA_1992
22-06-2011, 22:34
ILIA_1992, это Need for Speed™ Undercover.iss v 2.2 из шапки этой темы с вырезанной статус-панелью »
а у теюя слуяайно не завалялся скрипт.У меня есть скрипт,но он недоделан.Не распаковывает bin файлы и не получается убрать язык русский и английский
ILIA_1992,
Вот здесь (http://www.forum.oszone.ru/post-1409866-1784.html) скачать его можно же
ILIA_1992
23-06-2011, 12:29
Вот здесь скачать его можно же »
я его скачал,при распаковке процент распаковки доходит до 41% и падает вниз.Помогите исправить
Gnom_aka_Lexander
23-06-2011, 14:13
ILIA_1992, Тут (http://forum.krinkels.ru/showthread.php?t=11) есть последняя версия этого скрипта, там все ошибки исправлены.
Лександер,
А в моем вопросе мне не поможете? :)
insombia
23-06-2011, 18:19
xXDx вот
Source: button2.bmp; DestDir: {tmp}; Flags: dontcopy
const
ButtonWidth = 80;
ButtonHeight = 23;
var
WizardLabel: TLabel;
ButtonPanel: array of TPanel;
ButtonImage: array of TBitmapImage;
ButtonLabel: array of TLabel;
UsedButtons: array of TButton;
ButtonsCount: Integer;
procedure ButtonLabelClick(Sender: TObject);
var Button: TButton; n, i: Integer;
begin
i:= TLabel(Sender).Tag; ButtonImage[i].Left:= 0
for n:=0 to (ButtonsCount-1) do begin
if i = n then Button:= UsedButtons[n];
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*2
end;
procedure ButtonLabelMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if ButtonLabel[TLabel(Sender).Tag].Enabled then ButtonImage[TLabel(Sender).Tag].Left:=0
end;
procedure ButtonLabelMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
var n, I: Integer;
begin
I:=TLabel(Sender).Tag;
//Сначала восстанавливаем картинку у всех кнопок, так надо иначе могут быть глюки
for n:=0 to (ButtonsCount-1) do begin if (ButtonLabel[n].Enabled)and(ButtonImage[n].Left <> -ButtonWidth*2)and(I<>N) then ButtonImage[n].Left:= 0; end;
//Теперь собственно ставим нужную картинку
if (ButtonLabel[I].Enabled)and(ButtonImage[I].Left <> -ButtonWidth*2) then begin ButtonImage[I].Left:= -ButtonWidth; end;
end;
procedure WizardLabelMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
var n: Integer;
begin
//Т.к Sender'ом выступает WizardLabel то не получится испльзовать индекс кнопки
for n:=0 to (ButtonsCount-1) do if (ButtonLabel[n].Enabled)and(ButtonImage[n].Left <> -ButtonWidth*2) then begin ButtonImage[n].Left:= 0; end;
end;
procedure LoadButtonImage(AButton: TButton);
var n: Integer;
begin
n:=ButtonsCount; SetArrayLength(ButtonPanel, n+1);
SetArrayLength(ButtonImage, n+1); SetArrayLength(ButtonLabel, n+1);
SetArrayLength(UsedButtons, n+1); UsedButtons[n]:= AButton;
ButtonPanel[n]:=TPanel.Create(WizardForm)
ButtonPanel[n].SetBounds(AButton.Left, AButton.Top, AButton.Width, AButton.Height)
ButtonPanel[n].Tag:= n
ButtonPanel[n].Enabled:= AButton.Enabled
ButtonPanel[n].Parent:=AButton.Parent
ButtonImage[n]:=TBitmapImage.Create(WizardForm)
ButtonImage[n].SetBounds(ScaleX(0), ScaleY(0), ScaleX(320), ScaleY(23))
ButtonImage[n].Enabled:=False
ButtonImage[n].Bitmap.LoadFromFile(ExpandConstant('{tmp}\Button2.bmp'))
ButtonImage[n].Parent:=ButtonPanel[n]
with TLabel.Create(WizardForm) do begin
Tag:=n
Parent:=ButtonPanel[n]
Width:=AButton.Width
Height:=AButton.Height
Transparent:=True
OnClick:=@ButtonLabelClick
OnDblClick:=@ButtonLabelClick
OnMouseMove:=@ButtonLabelMove
OnMouseDown:=@ButtonLabelMouseDown
OnMouseUp:=@ButtonLabelMouseUp
end
ButtonLabel[n]:=TLabel.Create(WizardForm)
ButtonLabel[n].Autosize:=True
ButtonLabel[n].Alignment:=taCenter
ButtonLabel[n].Tag:=n
ButtonLabel[n].Enabled:= AButton.Enabled
ButtonLabel[n].Transparent:=True
ButtonLabel[n].Font.Color:=clWhite
ButtonLabel[n].Caption:=AButton.Caption
ButtonLabel[n].OnClick:=@ButtonLabelClick
ButtonLabel[n].OnDblClick:=@ButtonLabelClick
ButtonLabel[n].OnMouseMove:=@ButtonLabelMove
ButtonLabel[n].OnMouseDown:=@ButtonLabelMouseDown
ButtonLabel[n].OnMouseUp:=@ButtonLabelMouseUp
ButtonLabel[n].Parent:=ButtonPanel[n]
ButtonsCount:= ButtonsCount+1
end;
procedure UpdateButtons();
var n: Integer;
begin
for n:=0 to ButtonsCount-1 do begin
ButtonLabel[n].Caption:=UsedButtons[n].Caption
ButtonPanel[n].Visible:=UsedButtons[n].Visible
if (UsedButtons[n].Enabled = False) then ButtonImage[n].Left:= -ButtonWidth*3 else ButtonImage[n].Left:= 0;
ButtonLabel[n].Enabled:= UsedButtons[n].Enabled;
ButtonPanel[n].Enabled:= UsedButtons[n].Enabled;
//Ставим Left и Top лейбла соразмерно размеру лейбла
ButtonLabel[n].Left:= ButtonPanel[n].Width div 2 - ButtonLabel[n].Width div 2;
ButtonLabel[n].Top:= ButtonPanel[n].Height div 2 - ButtonLabel[n].Height div 2;
end;
end;
procedure LicenceAcceptedRadioOnClick(Sender: TObject);
begin
//Делаем кнопку активной
WizardForm.NextButton.Enabled:= True;
//Обновляем текстурированную кнопку (обновляем активность и текстуру)
UpdateButtons();
end;
procedure LicenceNotAcceptedRadioOnClick(Sender: TObject);
begin
//Делаем кнопку неактивной
WizardForm.NextButton.Enabled:= False;
//Обновляем текстурированную кнопку (обновляем активность и текстуру)
UpdateButtons()
end;
procedure InitializeWizard();
begin
WizardLabel:= TLabel.Create(WizardForm)
WizardLabel.SetBounds(ScaleX(0), ScaleY(0), ScaleX(WizardForm.Width), ScaleY(WizardForm.Height))
WizardLabel.Transparent:= True;
WizardLabel.AutoSize:=false;
WizardLabel.OnMouseMove:=@WizardLabelMove
WizardLabel.Parent:= WizardForm;
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:=ScaleX(337)
WizardForm.DirBrowseButton.Width:= ButtonWidth
WizardForm.DirBrowseButton.Height:=ButtonHeight
WizardForm.GroupBrowseButton.Left:=ScaleX(337)
WizardForm.GroupBrowseButton.Width:= ButtonWidth
WizardForm.GroupBrowseButton.Height:=ButtonHeight
WizardForm.LicenseAcceptedRadio.OnClick:=@LicenceAcceptedRadioOnClick
WizardForm.LicenseNotAcceptedRadio.OnClick:=@LicenceNotAcceptedRadioOnClick
ExtractTemporaryFile('button2.bmp')
LoadButtonImage(WizardForm.BackButton)
LoadButtonImage(WizardForm.NextButton)
LoadButtonImage(WizardForm.CancelButton)
LoadButtonImage(WizardForm.DirBrowseButton)
LoadButtonImage(WizardForm.GroupBrowseButton)
end;
procedure CurPageChanged(CurPageID: Integer);
begin
UpdateButtons()
end;
Gnom_aka_Lexander
23-06-2011, 18:21
xXDx, не помогу, никода не скинировал кнопки этим скриптом, и подозреваю, что все там нормально, косяк где-нибудь при подключении к своему скрипту.
insombia,
Нет не получилось, тогда подскажите скрипт, чтоб белой обводки вокруг кнопок не было. Ниже скриншот
http://images.slvnet.ru/754231196.png (http://images.slvnet.ru/754231196.png)
© OSzone.net 2001-2012
vBulletin v3.6.4, Copyright ©2000-2025, Jelsoft Enterprises Ltd.