5

我创建了一个带有图像的自定义欢迎页面,但顶部的主面板仍有待显示。对于我想要实现的目标,请参见下图:

在此处输入图像描述

这是代码:

[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;

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

4

1 回答 1

8

您需要在切换到欢迎页面时隐藏和组件Bevel1,并在离开时再次显示它们。相反,只有在显示欢迎页面时才需要显示图像,因为它覆盖了整个页面区域。所以下面的代码可以解决问题:MainPanelInnerNotebook

[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;
于 2012-06-22T12:35:24.663 回答