Registriert seit: 22. Jun 2018
2.175 Beiträge
|
AW: Wie verwendet man die neue TVirtualImageList
11. Jun 2020, 13:27
Gibt es sowas auch für Icon? Ich versuche mich hier gerade wieder dumm und dämlich.
Ich habe das aktuell so
Delphi-Quellcode:
type
TImageHelper = class helper for TImage
public
procedure GetImage(Source: TImageCollection; Index: Integer); overload;
procedure GetImage(Source: TImageCollection; const AName: string); overload;
end;
type
TImageCollectionHelper = class helper for TImageCollection
public
function GetScaledImage(AIndex, AWidth, AHeight: Integer): TWICImage; overload;
end;
implementation
procedure TImageHelper.GetImage(Source: TImageCollection; Index: Integer);
var
img: TWICImage;
begin
img := Source.GetScaledImage(Index, Width, Height);
try
Picture.Graphic := img;
finally
img.Free;
end;
end;
procedure TImageHelper.GetImage(Source: TImageCollection; const AName: string);
var
Index: Integer;
begin
Index := Source.GetIndexByName(AName);
if Index > -1 then
GetImage(Source, Index);
end;
function TImageCollectionHelper.GetScaledImage(AIndex, AWidth, AHeight: Integer): TWICImage;
begin
Result := GetScaledImage(GetSourceImage(AIndex, AWidth, AHeight), AWidth, AHeight);
end;
Geändert von DieDolly (11. Jun 2020 um 13:31 Uhr)
|
|
Zitat
|