• Miércoles 15 de Mayo de 2024, 08:03

Autor Tema:  Ayuda Con Jpeg En Formulario  (Leído 1328 veces)

moyo18

  • Nuevo Miembro
  • *
  • Mensajes: 9
    • Ver Perfil
Ayuda Con Jpeg En Formulario
« en: Lunes 26 de Febrero de 2007, 22:50 »
0
buneo he estado busca y busca y he encontrado algunos codigos, he hehco paso a paso lo q iban diciendo y si he logrado hacerlo pero cuando ya quiero ver la foto, ejecutar el programa para ver si se peude me sale un error en el codigo y por mas vuelta q le doy no veo dond esta el fallo ya q muchos codigos son iguales

aki les dejo el codigo q llevo


Código: Text
  1.  
  2. unit database;
  3.  
  4. interface
  5.  
  6. uses
  7.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  8.   Dialogs, StdCtrls, ExtCtrls, DB, ADODB, Grids, DBGrids;
  9.  
  10. type
  11.   TForm1 = class(TForm)
  12.     DBGrid1: TDBGrid;
  13.     ADOTable1: TADOTable;
  14.     DataSource1: TDataSource;
  15.     ADOConnection1: TADOConnection;
  16.     ADOimage: TImage;
  17.     Button1: TButton;
  18.     procedure Button1Click(Sender: TObject);
  19.   private
  20.     { Private declarations }
  21.   public
  22.     { Public declarations }
  23.   end;
  24.  
  25. var
  26.   Form1: TForm1;
  27.  
  28. implementation
  29.  uses jpeg;
  30. {$R *.dfm}
  31.  
  32. function JpegStartsInBlob
  33.          (PicField:TBlobField):integer;
  34. var
  35.  bS     : TADOBlobStream;
  36.  buffer : Word;
  37.  hx     : string;
  38. begin
  39.  Result := -1;
  40.  bS := TADOBlobStream.Create(PicField, bmRead);
  41.  try
  42.   while (Result = -1) and
  43.         (bS.Position + 1 < bS.Size) do
  44.   begin
  45.    bS.ReadBuffer(buffer, 1);
  46.    hx:=IntToHex(buffer, 2);
  47.    if hx = 'FF' then begin
  48.      bS.ReadBuffer(buffer, 1);
  49.      hx:=IntToHex(buffer, 2);
  50.      if hx = 'D8' then Result := bS.Position - 2
  51.      else if hx = 'FF' then
  52.         bS.Position := bS.Position-1;
  53.    end; //if
  54.   end; //while
  55.  finally
  56.   bS.Free
  57.  end;  //try
  58. end;
  59.  
  60.  
  61. procedure TForm1.Button1Click(Sender: TObject);
  62. var
  63.   bS  : TADOBlobStream;
  64.   Pic : TJpegImage;
  65. begin
  66.   bS := TADOBlobStream.Create
  67.         (AdoTable1Picture, bmRead);
  68.   try
  69.     bS.Seek(JpegStartsInBlob(AdoTable1Picture),
  70.             soFromBeginning);
  71.     Pic:=TJpegImage.Create;
  72.     try
  73.      Pic.LoadFromStream(bS);
  74.      ADOImage.Picture.Graphic:=Pic;
  75.     finally
  76.      Pic.Free;
  77.     end;
  78.   finally
  79.     bS.Free
  80.   end;
  81. end;
  82.  



y aki me da el error, es en el boton

Código: Text
  1. bS := TADOBlobStream.Create
  2.         (AdoTable1Picture, bmRead);
  3.  

a dond dice Adotable1picture, bmread a ver si me pueden decir el error ahi ya t  se supone q esta bien todo porq lo saque d aki

delphi.about.com/od/database/l/aa030601d.htm

porq me da un error??