Reputation: 2951
I am just using the trial version of AppMethod 1.17 aka Delphi 10 Seattle. Therefore I cannot look into the source code.
In VCL I used TImageList.Draw()
, but with the new TMultiResBitmap class I don't know how to use it.
Upvotes: 3
Views: 7242
Reputation: 7397
Another approach would be to add the bitmap into the MultiResBitmap of the TImage:
var
sz: TSize;
bmpSrc, bmpTgt: TBitmap;
...
// Obtain the bitmap (e.g. from ImageList in data-module)
sz := TSize.Create(MaxInt, MaxInt); // Pick best size
DataModule1.ImageList1.BestSize(3, sz);
bmpSrc := DataModule1.ImageList1.Bitmap(sz, 3);
// Assign to Image1, to desired scale
bmpTgt := Image1.MultiResBitmap.Bitmaps[1.0];
bmpTgt.SetSize(bmpSrc.Size);
bmpTgt.Assign(bmpSrc);
Upvotes: 0
Reputation: 2951
I found a solution but don't know if that is the prefered way.
var
s: TSizeF;
begin
s.Create(32, 32); //Image size
myImage.Bitmap := myImageList.Bitmap(s,imageIndex);
end;
Upvotes: 5