FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Temas de Hoy |
|
Herramientas | Buscar en Tema | Desplegado |
#1
|
||||
|
||||
Mostrar una imagen JPG
Hola a todos,... estuve buscando en el foro y encontre la manera de mostrar en un TImage una imagen almacenada en un campo de access tipo OLE... creo haber buscado lo suficiente como para pedir a alguien me pueda decir porque me sale el error "Invalid class typecast" en la linea donde hago el "SaveToStream"...¿¿???
Aqui esta el codigo:
Desde ya muchas gracias... espero haber dicho todo como para recibir alguna ayudita Última edición por dec fecha: 18-01-2007 a las 00:17:05. |
#2
|
||||
|
||||
Ya encontre la solucion...
Estuve buscando mas ejemplos y pude solucionar mi problema...
Acá pongo el codigo que quedo finalmente: Código Delphi [-]procedure TfraDefinicionNotificadores.MostrarFoto; var bS : TADOBlobStream; Pic : TJpegImage; begin bS := TADOBlobStream.Create(ADONotificadoresFoto, bmRead); try bS.Seek(JpegStartsInBlob(ADONotificadoresFoto), soFromBeginning); Pic:=TJpegImage.Create; try if Length(ADONotificadoresFoto.AsString)>0 then begin Pic.LoadFromStream(bS); imgFoto.Picture.Graphic:=Pic; end else imgFoto.Picture.Assign(nil); finally Pic.Free; end; finally bS.Free end; end; Código Delphi [-]function TfraDefinicionNotificadores.JpegStartsInBlob( PicField: TBlobField): integer; var bS : TADOBlobStream; buffer : Word; hx : string; begin Result := -1; bS := TADOBlobStream.Create(PicField, bmRead); try while (Result = -1) and (bS.Position + 1 < bS.Size) do begin bS.ReadBuffer(buffer, 1); hx:=IntToHex(buffer, 2); if hx = 'FF' then begin bS.ReadBuffer(buffer, 1); hx:=IntToHex(buffer, 2); if hx = 'D8' then Result := bS.Position - 2 else if hx = 'FF' then bS.Position := bS.Position-1; end; //if end; //while finally bS.Free end; //try end; |
|
|
Temas Similares | ||||
Tema | Autor | Foro | Respuestas | Último mensaje |
mostrar una imagen en un DBGrid | adebonis | Varios | 12 | 25-09-2012 13:33:00 |
Mostrar Imagen remota ( desde internet ) | MRSAM | Internet | 4 | 30-11-2006 22:28:57 |
Mostrar imagen de un campo binario | kiketijuana | SQL | 0 | 28-06-2006 01:20:33 |
como mostrar una imagen a base de un componente | Nelly | Varios | 7 | 01-12-2005 15:50:43 |
Mostrar mi cursor en una imagen | franc28 | Varios | 4 | 25-04-2005 19:17:39 |
|