Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi TImage wird nicht transparent dargestellt (https://www.delphipraxis.net/93477-timage-wird-nicht-transparent-dargestellt.html)

guidobrose 6. Jun 2007 14:40


TImage wird nicht transparent dargestellt
 
Hallo, ich verwende auf meinem Form ein TImage, um den Status einer Verbindug grafisch darzustellen. Die Bitmaps kommen dabei aus einer TImageList und werden per Code zugewiesen.

Delphi-Quellcode:
Llesy.ImgLst24x24.GetBitmap(1,Llesy.ImgStatusConnection.Picture.Bitmap);
Funktioniert auch (fast) bestens, leider wird das Image nicht transparent dargestellt. Weise ich das Bitmap zur Entwurfszeit im Objektinspektor zu und setze Transparent auf True, dann funktioniert es, nicht im anderen Fall. Was tun?

Danke, Guido

DeddyH 6. Jun 2007 15:02

Re: TImage wird nicht transparent dargestellt
 
TransparentColor neu setzen? Nur eine Vermutung

DGL-luke 6. Jun 2007 15:03

Re: TImage wird nicht transparent dargestellt
 
hallo, das sollte man etwas anders machen:

Delphi-Quellcode:
var
  tempBmp: TBitmap;
begin
  Imaglist.GetBitmap(index, tempBmp);

  tempBmp.Transparent := true;
  Image.Picture.Graphic.Assign(tempBmp);
end;
So müssts auch funktionieren.

dominikkv 6. Jun 2007 15:08

Re: TImage wird nicht transparent dargestellt
 
Zitat:

Zitat von DGL-luke
hallo, das sollte man etwas anders machen:

Delphi-Quellcode:
var
  tempBmp: TBitmap;
begin
  Imaglist.GetBitmap(index, tempBmp);

  tempBmp.Transparent := true;
  Image.Picture.Graphic.Assign(tempBmp);
end;
So müssts auch funktionieren.

vor dem GetBitmap fehlt ein
Delphi-Quellcode:
tempBmp := TBitMap.Create;
sonst gibts ne Fehlermeldung :zwinker:
ansonsten würd ich auch mal
Delphi-Quellcode:
tempBmp.PixelFormat := pf24Bit;
probieren...

Delphi-Quellcode:
var
  tempBmp: TBitmap;
begin
  tempBmp := TBitMap.Create;
  Imaglist.GetBitmap(index, tempBmp);
  tempBmp.PixelFormat := pf24Bit;
  tempBmp.Transparent := true;
  Image.Picture.Graphic.Assign(tempBmp);
end;
[edit] ... es fehlt am schluss noch ein
Delphi-Quellcode:
tempBmp.free;
[/edit]

guidobrose 6. Jun 2007 15:09

Re: TImage wird nicht transparent dargestellt
 
Hab noch mal ein wenig probiert - ohne Erfolg bisher - auch mit Bitmap.TransparentMode:=tmAuto, dann sollte die Transparente Farbe automatisch zugewiesen werden, nichts.

Habe auch schon mal Transparent auf False gesetzt, das Bitmap zugewiesen und anschließend auf True, nada.

mkinzler 6. Jun 2007 15:11

Re: TImage wird nicht transparent dargestellt
 
Hast du auch schon versucht die transparente Farbe explizit zu setzen?

guidobrose 6. Jun 2007 15:11

Re: TImage wird nicht transparent dargestellt
 
Danke Dominik,

den Vorschlag mit dem temporären Bitmap hatte ich auch schon ausprobiert, aber das Pixelformat ist es gewesen. Es klappt!


Alle Zeitangaben in WEZ +1. Es ist jetzt 20:23 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