论坛风格切换切换到宽版
  • 7666阅读
  • 3回复

【已解决】再来请教高手一个关于INNO单选框选中之后所执行的操作问题 [复制链接]

上一主题 下一主题
离线qiuquan
 

发帖
135
金钱
1370
威望
137
只看楼主 倒序阅读 0 发表于: 2010-12-02
我先简单说明一下问题:
是这样的,我自定义了一个安装完成界面,该界面是整张图片铺满安装程序窗口,但由于安装完成界面中Runlist控件的背景是白色的,这样使得图片中加入了一个白框,看起来很不协调,图片效果大致如下:



为了实现图片中想达到的效果,尝试在结束界面中新建一个单选框,但是如何才能使所新建的单选框作用和原来Runlist控件的单选框链接起来?

代码如下,也上传了附件,希望朋友们能帮帮忙,谢谢了。

; 脚本用 Inno Setup 脚本向导 生成。
; 查阅文档获取创建 INNO SETUP 脚本文件的详细资料!
[Setup]
; 注意: AppId 的值是唯一识别这个程序的标志。
; 不要在其他程序中使用相同的 AppId 值。
; (在编译器中点击菜单“工具 -> 产生 GUID”可以产生一个新的 GUID)
AppId={{39EC10E8-A407-4508-96FE-FE5E145EAA4F}
AppName=我的程序
AppVersion=1.5
;AppVerName=我的程序 1.5
AppPublisher=我的公司
DefaultDirName={pf}\我的程序
DefaultGroupName=我的程序
AllowNoIcons=yes
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
WizardImageFile=WizModernImage.bmp

[Languages]
Name: "default"; MessagesFile: "compiler:Default.isl"

[Code]
var
CheckBox1: TCheckBox;
procedure InitializeWizard();
begin
CheckBox1 := TCheckBox.Create(WizardForm);
CheckBox1.Parent := WizardForm.FinishedPage;
CheckBox1.Left := 18
CheckBox1.Top := ScaleY(100);
CheckBox1.Width := ScaleY(15);
CheckBox1.Height := ScaleY(15);
CheckBox1.TabOrder := 0;
CheckBox1.State := cbChecked

WizardForm.WizardBitmapImage2.Width:= 479
WizardForm.WizardBitmapImage2.Height:= 290
//设置RunList位置
Wizardform.RunList.Visible:= false;
Wizardform.RunList.Top:= 130;
Wizardform.RunList.Left:= 15;
Wizardform.RunList.Height:= -78;
Wizardform.FinishedHeadingLabel.Width:= 0;
Wizardform.FinishedHeadingLabel.Height:= 0;
Wizardform.FinishedLabel.Width:= 0;
Wizardform.FinishedLabel.Height:= 0;
end;
[Run]
Filename: "{app}\MyProg.exe"; Description: "{cm:LaunchProgram,我的程序}"; Flags: nowait postinstall skipifsilent



[ 此帖被qiuquan在2010-12-03 21:21重新编辑 ]
附件: 测试.rar (450 K) 下载次数:34
离线gnatix

发帖
7696
金钱
-8279
威望
-828
只看该作者 1 发表于: 2010-12-03
checkbox1 的文字还是有背景的,所以你还必须另外创建一个透明的文字。至于把选中 checkbox1 等同于选中 RunList,这个比较容易。
完整的代码应该是下面的样子,供参考。
[Setup]
AppName=我的程序
AppVerName=我的程序 1.5
DefaultDirName={pf}\我的程序
DefaultGroupName=我的程序
WizardImageFile=WizModernImage.bmp

[Files]
Source: "MyProg.exe"; DestDir: "{app}"

[Run]
Filename: "{app}\MyProg.exe"; Description: "我的程序"; Flags: nowait postinstall skipifsilent

[Code]
var
CheckBox1: TCheckBox;
newlabel: TLabel;

procedure InitializeWizard();
begin
CheckBox1 := TCheckBox.Create(WizardForm);
CheckBox1.Parent := WizardForm.FinishedPage;
CheckBox1.Left := 18
CheckBox1.Top := ScaleY(100);
CheckBox1.Width := ScaleY(15);
CheckBox1.Height := ScaleY(15);
CheckBox1.TabOrder := 0;
CheckBox1.State := cbChecked

WizardForm.WizardBitmapImage2.Width:= 479
WizardForm.WizardBitmapImage2.Height:= 290

// 不显示原有文字
Wizardform.FinishedHeadingLabel.Visible:= false;
Wizardform.FinishedLabel.Visible:= false;
// 添加透明文字
newlabel:= TLabel.Create(WizardForm);
newlabel.Parent := WizardForm.FinishedPage;
newlabel.Transparent:= true;
newlabel.Top := CheckBox1.Top + ScaleY(2);
newlabel.Left := CheckBox1.Left+ScaleX(20);
newlabel.Caption:= '运行 你的程序';
end;

procedure CurPageChanged(CurPageID : Integer);
begin
if CurPageID=wpFinished then
Wizardform.RunList.Visible:= false;
end;

function NextButtonClick(CurPageID : Integer): Boolean;
begin
result:= true;
if CurPageID=wpFinished then
wizardform.RunList.Checked[0]:= checkbox1.Checked;
end;

效果图:
离线qiuquan

发帖
135
金钱
1370
威望
137
只看该作者 2 发表于: 2010-12-03
虎兄真厉害! 对于我来说很难的问题,到了你手里就变得那么的轻而易举,非常感谢!
离线hbfnmxb

发帖
102
金钱
670
威望
67
只看该作者 3 发表于: 2010-12-07
非常好东西,太好了