inno-setup – 如何隐藏主面板并在整个页面上显示图像?

前端之家收集整理的这篇文章主要介绍了inno-setup – 如何隐藏主面板并在整个页面上显示图像?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我创建了一个自定义欢迎页面,上面有图像,但顶部的主面板仍然显示.对于我想要实现的目标,请参见下图:

这是代码

[Code]
procedure InitializeWizard;
var
  BitmapFileName: string;
  BitmapImage: TBitmapImage;
  WelcomePage: TWizardPage;
begin
  WelcomePage := CreateCustomPage(wpWelcome,'','');    

  BitmapFileName := ExpandConstant('{tmp}\Datanova_logo.bmp');
  ExtractTemporaryFile(ExtractFileName(BitmapFileName));

  BitmapImage := TBitmapImage.Create(WelcomePage);
  BitmapImage.AutoSize := True;
  BitmapImage.Bitmap.LoadFromFile(BitmapFileName);
  BitmapImage.Cursor := crHand;
  BitmapImage.Left := 10;
  BitmapImage.Top := 10;
  BitmapImage.Parent := WelcomePage.Surface;
end;

如何在隐藏主面板的情况下在整个页面显示图像?

解决方法

切换到欢迎页面时需要隐藏Bevel1,MainPanel和InnerNotebook组件,并在离开时再次显示它们.相反,只有当您显示欢迎页面时才需要显示图像,因为它覆盖整个页面区域.所以下面的代码将起到作用:
[Code]
var
  WelcomePageID: Integer;
  BitmapImage: TBitmapImage;

procedure InitializeWizard;
var
  WelcomePage: TWizardPage;  
begin
  WelcomePage := CreateCustomPage(wpWelcome,'');
  WelcomePageID := WelcomePage.ID;
  BitmapImage := TBitmapImage.Create(WizardForm);
  BitmapImage.Bitmap.LoadFromFile('C:\Image.bmp');
  BitmapImage.Top := 0;
  BitmapImage.Left := 0;
  BitmapImage.AutoSize := True;
  BitmapImage.Cursor := crHand;
  BitmapImage.Visible := False;
  BitmapImage.Parent := WizardForm.InnerPage;
end;

procedure CurPageChanged(CurPageID: Integer);
begin
  BitmapImage.Visible := CurPageID = WelcomePageID;
  WizardForm.Bevel1.Visible := CurPageID <> WelcomePageID;
  WizardForm.MainPanel.Visible := CurPageID <> WelcomePageID;
  WizardForm.InnerNotebook.Visible := CurPageID <> WelcomePageID;
end;
原文链接:https://www.f2er.com/delphi/103093.html

猜你在找的Delphi相关文章