Ver Mensaje Individual
  #3  
Antiguo 29-09-2016
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 36
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola Ramsay.

Creo que usamos distintas versiones de Delphi y/o biblioteca para el manejo de png, pero del modo de este ejemplo no obtengo error, fijate si te sirve de algo.
Código Delphi [-]
...
uses PngImage;

procedure TForm1.FormCreate(Sender: TObject);
begin
  ImageList1.Width  := 100;
  ImageList1.Height := 64;
end;

procedure ImageListAddPng(ImgLst: TImageList; const R: TRect; const PngFileName: string);
var
  png : TPngObject;
  bmp : TBitmap;
begin
  png := TPngObject.Create();
  bmp := TBitmap.Create();
  try
    png.LoadFromFile(PngFileName);
    bmp.PixelFormat := pf32bit;
    bmp.Height := png.Height;
    bmp.Width  := png.Width;
    bmp.Assign(png);
    bmp.Canvas.StretchDraw(R, bmp);
    ImgLst.Add(bmp, nil);
  finally
    png.Free();
    bmp.Free();
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  ImageListAddPng(ImageList1, Rect(0, 0, 100, 64), 'facepalm.png');
  SpeedButton1.Caption := '';
  ImageList1.GetBitmap(0, SpeedButton1.Glyph);
end;

Salida:


Saludos
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....
Responder Con Cita