Auch hierfür gibt es eine Lösung:
Das Bitmap verwendet das untere linke Pixel als transparente Farbe.
Bei einer Verknüpfung ist dieses Pixel schwarz, somit wird der schwarze Verknüpfungs-Pfeil transparent.
Durch die Zeile
SpeedButton1.Glyph.TransparentColor := clNone;
sollte das Problem allerdings behoben sein.
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
ICO: TIcon;
IconIndex: Word;
buf: array[0..max_path] of Char;
begin
ICO := TIcon.Create;
try
StrPCopy(buf, Edit1.Text);
IconIndex := 0;
ICO.Handle := ExtractAssociatedIcon(hInstance, buf, IconIndex);
SpeedButton1.Glyph.Width := ICO.Width;
SpeedButton1.Glyph.Height := ICO.Height;
SpeedButton1.Glyph.TransparentColor := clNone;
SpeedButton1.Glyph.Canvas.Brush.Color := Color;
SpeedButton1.Glyph.Canvas.FillRect(Rect(0, 0, SpeedButton1.Glyph.Width, SpeedButton1.Glyph.Height));
SpeedButton1.Glyph.Canvas.Draw(0, 0, ICO);
finally
ICO.Free;
end;
end;