Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Multimedia (https://www.delphipraxis.net/16-multimedia/)
-   -   TImageListe -> TImage (https://www.delphipraxis.net/214011-timageliste-timage.html)

Incocnito 6. Nov 2023 09:47

TImageListe -> TImage
 
Liste der Anhänge anzeigen (Anzahl: 1)
Moin zusammen,

ich hänge hier gerade mit einem ganz billigen Problem:
Ich habe eine TImageList, eingestellt auf 32x32 Pixel.
Und auf der anderen Seite ein TImage, welches ich auch 32x32 Pixel groß gemacht habe.
Wenn ich nun versuche das Bild in das TImage rein zu laden, passt es nicht.
Mein aktueller Ansatz:
Delphi-Quellcode:
  bmp := TBitmap.Create();
  //bmp.Canvas.FillRect(TRect.Create(0, 0, 32, 32)); // Clear
  ImageList32.GetBitmap(9, bmp);
  imgArbeitsplatz.Picture.Assign(bmp);
  bmp.Free();
Ich habe auch schon versucht vorab das BMP auf 32x32 Pixel zu stellen, aber das ändert nichts.
Ich habe zum Testen auch mal das Bild aus der ImageList exportiert als BMP-Datei und diese ist
auch 32x32 Pixel groß.
Es scheint, als wenn das Bild nicht bei (0,0) anfängt, sondern um 3-4 Pixel verschoben wird.
Hinweis: Die Clear-Zeile nutze ich für einen transparenten Hintergrund. Für das Beispiel ist das aber gerade hinderlich.

Wo ist mein Fehler?

Vielen Dank für die Mühe und Zeit
Incocnito

itsChris 6. Nov 2023 11:03

AW: TImageListe -> TImage
 
Moin,
probier mal das hier:
Code:
imgArbeitsplatz.Stretch := True;
imgArbeitsplatz.Proportional := True;
ImageList32.GetBitmap(9, imgArbeitsplatz.Picture.Bitmap);
Vorher muss natürlich noch die Größe des Images gesetzt werden.

Incocnito 6. Nov 2023 12:25

AW: TImageListe -> TImage
 
Zitat:

Zitat von itsChris (Beitrag 1529119)
Moin,
probier mal das hier:
Code:
imgArbeitsplatz.Stretch := True;
imgArbeitsplatz.Proportional := True;
ImageList32.GetBitmap(9, imgArbeitsplatz.Picture.Bitmap);
Vorher muss natürlich noch die Größe des Images gesetzt werden.

Jo damit geht es. Seltsam. Aber danke für den Tipp!

LG Incocnito


Alle Zeitangaben in WEZ +1. Es ist jetzt 14:06 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz