我想使用TBitmapImage
类将自定义设计的按钮添加到我的Inno脚本中。
我的Inno Setup脚本可以正常编译,但是位图没有显示在表单中。我调查了所有可能性,但似乎找不到我所犯的错误。这就是TBitmapImage
部分看起来像atm的样子:
procedure CreateMuteButton(ParentForm: TSetupForm);
var
MuteImage: TBitmapImage;
BitmapFileName: String;
begin
BitmapFileName := ExpandConstant('{tmp}\muteBtn.bmp');
ExtractTemporaryFile(ExtractFileName(BitmapFileName));
MuteImage := TBitmapImage.Create(ParentForm);
MuteImage.Bitmap.LoadFromFile(BitmapFileName);
MuteImage.Cursor := crHand;
MuteImage.OnClick := @MuteButtonOnClick;
MuteImage.Parent := ParentForm;
MuteImage.Left := 45;
MuteImage.Top := 80
MuteImage.Width := 38;
MuteImage.Height := 50;
end;
procedure InitializeWizard();
var
val: Integer;
begin
CreateMuteButton(WizardForm);
(...)
end;
最佳答案
WizardForm
客户区本身仅在底部斜角线下方可见。上面是WizardForm.InnerPage
,中间的单个/当前向导页面包含在私有(private)InnerNotebook
中。
这会将图像放在页面的左侧:
MuteImage := TBitmapImage.Create(WizardForm.InnerPage);
MuteImage.Parent := WizardForm.InnerPage;
MuteImage.Left := 0;
{ Uses the top of the wizard pages to line up }
MuteImage.Top := WizardForm.SelectDirPage.Parent.Top;
而这放在底部:
MuteImage := TBitmapImage.Create(WizardForm);
MuteImage.Parent := WizardForm;
MuteImage.Left := 0;
{ Below the inner page }
MuteImage.Top := WizardForm.InnerPage.Height;