Pascal Scripting: InitializeBitmapImageFromIcon

Prototype:

function InitializeBitmapImageFromIcon(const BitmapImage: TBitmapImage; const IconFilename: String; const BkColor: TColor; const AscendingTrySizes: TArrayOfInteger): Boolean;

Description:

Initializes the given bitmap image with an icon from the given icon file using the given background color for transparent parts.

The bitmap image should be scaled already and the function will load the largest fitting icon which has a size from the given array of sizes. After loading the function will set the size of the bitmap image to the loaded size.

The array must be sorted already from smallest to highest size.

Returns True if the icon could be loaded, False otherwise.

Example:
procedure InitializeWizard;
var
  Page: TWizardPage;
  BitmapImage: TBitmapImage;
begin
  Page := CreateCustomPage(wpWelcome, 'Test', 'Test');

  BitmapImage := TBitmapImage.Create(Page);
  
  with BitmapImage do begin
    Width := ScaleX(32);
    Height := ScaleY(32);
    Parent := Page.Surface;
  end;

  InitializeBitmapImageFromIcon(BitmapImage, 'MyProg.ico', Page.SurfaceColor, [32, 48, 64]);
end;