Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Gráficos (https://www.clubdelphi.com/foros/forumdisplay.php?f=8)
-   -   BMP en grid (https://www.clubdelphi.com/foros/showthread.php?t=58465)

harpo 21-07-2008 19:00:39

BMP en grid
 
Buenas,

necesito mostrar una serie de imágenes jpeg en un grid (concretamente un GridView de http://www.bergsoftware.net/). El problema de este grid es que con él solo se pueden mostrar bmp de 32x32 :(.

Mi código de pruebas:

Código:

var
  IO        :TImageEnIO;
  Stream    :TStream;
  BMPStream :TStream;
  BMP      :TBitmap;
begin
  try
    IO := TImageEnIO.Create(Self);
    BMP := TBitmap.Create;
    BMPStream := TMemoryStream.Create;
    if ResultType = rtImage then
    begin
      Stream:=(NewRecord as TFileData).Thumbnail;
      if Assigned(Stream) then
        IO.LoadFromStreamJPEG(Stream);
        //IO.SaveToFileBMP('C:\p.bmp');
        IO.SaveToStreamBMP(BMPStream);
        BMP.LoadFromStream(BMPStream);
        BMP.Width := 32;
        BMP.Height := 32;
        DBImageList.Insert(DBImageList.Count-1,BMP,nil);
        gvResult.CellByName['image','Last'].AsInteger := DBImageList.Count-1;
    end;
  finally
    IO.Free;
    BMP.Free;
    BMPStream.Free;
    Stream.Free;
  end;

IO es un componente de ImageEn (http://www.hicomponents.com) que en este caso lo único que hace es cargar el jpeg y guardarlo en un stream bmp. El problema lo tengo al guardar las imágenes en la TImageList, si las añado en tiempo de diseño se muestran bien, sin embargo, en runtime no. He probado a no hacer el free de BMP, pero igual.

Alguna idea?

Gracias :)


La franja horaria es GMT +2. Ahora son las 14:09:29.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi