Ver Mensaje Individual
  #2  
Antiguo 20-07-2004
Avatar de tcp_ip_es
tcp_ip_es tcp_ip_es is offline
No confirmado
 
Registrado: ago 2003
Ubicación: Madrid
Posts: 635
Reputación: 0
tcp_ip_es Va por buen camino
Aquí te dejo un ejemplito donde meto una imagen en una tablita:
Código Delphi [-]
procedure TFFotos.CargarImagen2Click(Sender: TObject);
begin
 if opendialog1.Execute then
  begin
   TFotos.Append
   if TFotosFoto = NIL then TFotos.APPend
   else TFotos.Edit;
   TFotosFoto.LoadFromFile(opendialog1.FileName);
   TFotosTipo.Value := ansiuppercase(extractFileExt(opendialog1.FileName));
   TFotos.Post;
   TFotosAfterScroll(TFotos);
  end;
end;

procedure TFFotos.TFotosAfterScroll(DataSet: TDataSet);
var
 wTipo : byte;
 blob : tmemorystream;
 imJPG : TJpegImage;
begin
 blob := tmemorystream.create;
 imJPG := TJPEGIMage.create;
 try
   if TFotosTipo.Value = '.BMP' then wtipo := 0;
   if pos(TFotosTipo.Value,'.WMF.EMF') > 0 then wtipo := 1;
   if TFotosTipo.Value = '.JPG' then wtipo := 2;
   TFotosFoto.savetostream(blob);
   blob.position := 0;
   if blob.Size > 0 then
     case wtipo of
       0: Image1.Picture.bitmap.loadfromstream(blob);
       1: Image1.Picture.metafile.loadfromstream(blob);
       2:
        begin
         imJPG.LoadFromStream(blob);
         Image1.Picture.assign(imjpg);
        end;
     end
    else
     begin
      image1.picture.metafile := NIL;
      image1.picture.bitmap := NIL;
      image1.picture.Graphic := NIL;      
     end;
  finally
   Blob.Free;
   imJPG.Free;
  end;
end;

Espero que te sirva....

Saludos, Tony
Responder Con Cita