Ver Mensaje Individual
  #1  
Antiguo 26-11-2014
Arnol125 Arnol125 is offline
Registrado
NULL
 
Registrado: nov 2014
Posts: 7
Reputación: 0
Arnol125 Va por buen camino
Visor de Imágenes Delphi 7

Buenos dias,

tengo este código para visualizar imágenes JPG, pero tiene un problema que no muestra la imagen el en componente Image1

Código Delphi [-]
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, FileCtrl, ExtCtrls, Buttons;

type
  TImageForm = class(TForm)
    DirectoryListBox1: TDirectoryListBox;
    FileListBox1: TFileListBox;
    DriveComboBox1: TDriveComboBox;
    Panel1: TPanel;
    Image1: TImage;
    Bevel1: TBevel;
    stretchcheck: TCheckBox;
    BitBtn1: TBitBtn;
    FileEdit: TEdit;
    ViewBtn: TButton;
    Label1: TLabel;
    procedure FileListBox1Click(Sender: TObject);
    procedure stretchcheckClick(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure ViewBtnClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  ImageForm: TImageForm;

implementation

uses Unit2;

{$R *.dfm}


procedure TImageForm.FileListBox1Click(Sender: TObject); //creo que aqui esta el error
var
  FileExt: string[4];
begin
  FileExt := UpperCase(ExtractFileExt(FileListBox1.Filename));
  if (fileExt='.jpg') then
  begin
  Image1.Picture.LoadFromFile(FileListBox1.Filename); // cargar imagen en el image1
  Label1.Caption:=extractfilename(filelistbox1.FileName); // cargar nombre del archivo en el label

  end;
end;

procedure TImageForm.stretchcheckClick(Sender: TObject);
begin
image1.stretch:=stretchcheck.checked; // ajustar tamaño de imagen al tamaño del image1
end;

procedure TImageForm.BitBtn1Click(Sender: TObject);
begin
close;
end;

procedure TImageForm.ViewBtnClick(Sender: TObject);
begin
 ViewForm.HorzScrollBar.Range := Image1.Picture.Width; // ampliar la imagen en una nueva mas grande
  ViewForm.VertScrollBar.Range := Image1.Picture.Height;
  ViewForm.Caption := Caption;
  ViewForm.Show;
  ViewForm.WindowState := wsNormal;
end;

end.

Última edición por roman fecha: 26-11-2014 a las 18:06:24. Razón: Agregar etiqueta [delphi]
Responder Con Cita