Hallo,
im Anhang sind 2 Bilder. Ein Icon und ein Bitmap.
Wie man sieht, ist auf dem Bitmap der Hintergrund weiss.
Wie bekomm ich diesen weissen Hintergrund weg?
Hier die Codes zum Auslesen von Icon und Bitmap.
Icon
Delphi-Quellcode:
var
IconIndex : Word;
h : hIcon;
begin
//Variablen initialisieren
IconIndex := 0;
//OpenDialog öffnen
If OpenDialog1.Execute then
begin
//Icon auslesen
h := ExtractIcon(0, PAnsiChar(OpenDialog1.FileName), IconIndex);
//Icon im Image anzeigen
Image1.Picture.Icon.Handle := h;
Image1.Picture.Icon.SaveToFile('d:\Excel.ico');
end;
end;
Bitmap
Delphi-Quellcode:
var
IconIndex : Word;
h : hIcon;
Bitmap : TBitmap;
Icon : TIcon;
begin
//Variablen initialisieren
IconIndex := 0;
//
Bitmap := TBitmap.Create;
Icon := TIcon.Create;
try
//OpenDialog öffnen
If OpenDialog1.Execute then
begin
//Icon auslesen
h := ExtractIcon(0, PAnsiChar(OpenDialog1.FileName), IconIndex);
Icon.Handle := h;
with Bitmap do
begin
Height := Icon.Height;
Width := Icon.Width;
Canvas.Draw(0, 0, Icon);
end;
Image1.Picture.Bitmap := Bitmap;
Image1.Picture.Bitmap.SaveToFile('d:\excel.bmp');
end;
finally
//
FreeAndNil(Bitmap);
FreeAndNil(Icon);
end;
end;
Mit dem OpenDialog wird eine Exe ausgewählt - in meinem Test die Excel.exe
mfg
Helmi
>> Theorie ist Wissen, dass nicht funktioniert - Praxis ist, wenn alles funktioniert und keiner weiss warum! <<