AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

FMX Imagelist PNG zufügen

Ein Thema von creehawk · begonnen am 18. Feb 2023 · letzter Beitrag vom 18. Feb 2023
 
Benutzerbild von softtouch
softtouch

Registriert seit: 13. Feb 2015
Ort: Kerpen
240 Beiträge
 
Delphi 12 Athens
 
#2

AW: FMX Imagelist PNG zufügen

  Alt 18. Feb 2023, 09:38
Vielleicht nicht 100%, aber so in etwa.

Code:
var
  si: TCustomSourceItem;
  d: TCustomDestinationItem;
  layer: TLayer;
  i,w,h:integer;
  st: TMemorystream;
begin
// favicons is the name of the image list
// st is a memorystream holding the image
// imagepath is a stringlist holding the filenames of the images

  favicons.ClearCache;
  favicons.Source.Clear;
  favicons.Destination.Clear;

  st:=TMemoryStream.create;

  for i:=0 to imagepath.count-1 do
  begin
    st.LoadFromFile(imagepath[i]);
    st.position:=0;
    si:=favicons.Source.Add;
    si.Name := 'image'+i.ToString;
    si.MultiResBitmap.LoadItemFromStream(st,1);
    si.MultiResBitmap.TransparentColor := TColorRec.Fuchsia;
    si.MultiResBitmap.SizeKind := TSizeKind.Custom;
    si.MultiResBitmap.Width := 16;
    si.MultiResBitmap.Height := 16;
    w:=si.MultiResBitmap.Bitmaps[1].Width;
    h:=si.MultiResBitmap.Bitmaps[1].Height;
    d:=favicons.Destination.Add;
    Layer := d.Layers.Add;
    Layer.SourceRect.Rect := TRectF.Create(0, 0, W , H);
    Layer.Name := si.name;
// Note: The index of the just added image can be retrieved with d.index here, to set for example the imageindex property in a listview item
  end;

  st.free;

end;
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 14:07 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz