Ver Mensaje Individual
  #7  
Antiguo 14-12-2004
paren paren is offline
Miembro
 
Registrado: jul 2004
Ubicación: Tijuana, B. C. Mexico
Posts: 18
Reputación: 0
paren Va por buen camino
Imagenes

Yo uso delphi 5.0 con Interbase 6.0

Puse dos TDBLookUpComboBox uno para seleccionar a un cliente o persona a la que se le guardaron las imagenes
El otro es para seleccionar las imagen que queremos ver

Para desplegarla use un TImage

Ademas use los componentes GraphicEx, QCadDraw que la verdad no recuerdo de donde los baje, pero de GraphicEx encontre la liga en estos foros

Espero que les sirva, perdon por no comentarlo, si quieren el fuente pos ahi me avisan
Código Delphi [-]
 uses
   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
   ExtCtrls, FileCtrl, StdCtrls, ComCtrls, ToolWin, Menus, DBCtrls, Db,
   ImgList, JPEG, GraphicEx, QCadDraw;
 
 
 ....
 type
   TfrmPrincipal = class(TForm)
     imgImagen: TImage;
     cdrwImagenCad: TCadDraw;
 ....
 
 
 procedure TfrmPrincipal.dblucbxDescripcionClick(Sender: TObject);
 Var
  Jpeg : TJpegImage;
  Gif : TGIFGraphic;
  Png : TPNGGraphic;
  Tif : TTIFFGraphic;
  Corriente : TMemoryStream;
  Buffer : Word;
  ImagenValida : Boolean;
 begin
  ImagenValida := True;
  imgImagen.Picture.Graphic := Nil;
  If dtamdlDatos.qryImagenIMAGEN.BlobSize > 0 Then
  Begin
   Corriente := TMemoryStream.Create;
   Try
    dtamdlDatos.qryImagenIMAGEN.SaveToStream(Corriente);
    Corriente.Seek(0,soFromBeginning);
    If Corriente.Read(Buffer, 2) > 0 Then
    Begin
     Corriente.Seek(0,soFromBeginning);
     If (Buffer = $2020) Or (Buffer = $3A44) Or (Buffer = $4956) Then
     Begin
      cdrwImagenCad.Visible := True;
      cdrwImagenCad.ZoomAll;
      tbtnEstirar.Enabled := False;
      imgImagen.Visible := False;
     End
     Else
     Begin
      tbtnEstirar.Enabled := True;
      cdrwImagenCad.Visible := False;
      imgImagen.Visible := True;
     End;
     Case Buffer Of
      $4D42 : imgImagen.Picture.Bitmap.LoadFromStream(Corriente); //Imagen BMP
      $0000 : imgImagen.Picture.Icon.LoadFromStream(Corriente); //Imagen ICO
      $0001 : imgImagen.Picture.Metafile.LoadFromStream(Corriente); //Imagen EMF
      $CDD7 : imgImagen.Picture.Metafile.LoadFromStream(Corriente); //Imagen WMF
      $D8FF : //Imagen JPG, JPEG
      Begin
       Jpeg := TJpegImage.Create;
       Jpeg.LoadFromStream(Corriente);
       imgImagen.Picture.Assign(Jpeg);
       Jpeg.Free;
      End;
      $4947 : //Imagen GIF
      Begin
       Gif := TGifGraphic.Create;
       Gif.LoadFromStream(Corriente);
       imgImagen.Picture.Assign(Gif);
       Gif.Free;
      End;
      $4949 : //Imagen TIF, TIFF
      Begin
       Tif := TTIFFGraphic.Create;
       Tif.LoadFromStream(Corriente);
       imgImagen.Picture.Assign(Tif);
       Tif.Free;
      End;
      $5089 : //Imagen PNG
      Begin
       Png := TPNGGraphic.Create;
       Png.LoadFromStream(Corriente);
       imgImagen.Picture.Assign(Png);
       Png.Free;
      End;
      $4956 : //Imagen CDL
      Begin
       cdrwImagenCad.CadType := 1;
       Corriente.SaveToFile(ExtractFilePath(ParamStr(0)) + 'imgtmp.cdl');
       cdrwImagenCad.LoadFromFile(ExtractFilePath(ParamStr(0)) + 'imgtmp.cdl');
       If FileExists(ExtractFilePath(ParamStr(0)) + 'imgtmp.cdl')
       Then DeleteFile(ExtractFilePath(ParamStr(0)) + 'imgtmp.cdl');
      End;
      $2020 : //Imagen DXF
      Begin
       cdrwImagenCad.CadType := 2;
       Corriente.SaveToFile(ExtractFilePath(ParamStr(0)) + 'imgtmp.dxf');
       cdrwImagenCad.LoadFromFile(ExtractFilePath(ParamStr(0)) + 'imgtmp.dxf');
       If FileExists(ExtractFilePath(ParamStr(0)) + 'imgtmp.dxf')
       Then DeleteFile(ExtractFilePath(ParamStr(0)) + 'imgtmp.dxf');
      End;
      $3A44 : //Imagen IGS
      Begin
       cdrwImagenCad.CadType := 3;
       Corriente.SaveToFile(ExtractFilePath(ParamStr(0)) + 'imgtmp.igs');
       cdrwImagenCad.LoadFromFile(ExtractFilePath(ParamStr(0)) + 'imgtmp.igs');
       If FileExists(ExtractFilePath(ParamStr(0)) + 'imgtmp.igs')
       Then DeleteFile(ExtractFilePath(ParamStr(0)) + 'imgtmp.igs');
      End;
      Else
      Begin
       imgImagen.Picture.Graphic := Nil;
       ImagenValida := False;
      End;
     End;
     If ImagenValida
     Then stbrBarraEstado.Panels[1].Text := Format('%d x %d', [imgImagen.Picture.Width, imgImagen.Picture.Height])
     Else stbrBarraEstado.Panels[1].Text := 'Formato de Imagen Invalido';
     If stbrBarraEstado.Panels[1].Text = '0 x 0'
     Then stbrBarraEstado.Panels[1].Text := 'Imagen CAD';
    End;
   Finally
    Corriente.Free;
   End;
  End;
 end;
Responder Con Cita