unit fpview;

interface

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

type
  TForm1 = class(TForm)
    Drive1: TDriveComboBox;
    Dir1: TDirectoryListBox;
    File1: TFileListBox;
    imgOpen: TImage;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Bevel1: TBevel;
    Label4: TLabel;
    Label5: TLabel;
    CheckBox1: TCheckBox;
    Bevel2: TBevel;
    procedure Drive1Change(Sender: TObject);
    procedure Dir1Change(Sender: TObject);
    procedure File1DblClick(Sender: TObject);
    procedure CheckBox1Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Drive1Change(Sender: TObject);
begin
  try
    Dir1.Drive := Drive1.Drive;
  except
    on E:EInOutError do
      MessageDlg('Disk drive is empty or invalid',mtWarning,[mbOK],0);
  end;
end;

procedure TForm1.Dir1Change(Sender: TObject);
begin
  File1.Directory := Dir1.Directory;
end;

procedure TForm1.File1DblClick(Sender: TObject);
begin
  Label1.Caption := File1.FileName;
  imgOpen.Picture.LoadFromFile (File1.FileName);
end;

procedure TForm1.CheckBox1Click(Sender: TObject);
begin
  imgOpen.Stretch := CheckBox1.Checked
end;

procedure TForm1.FormShow(Sender: TObject);
begin
  //Res independent Form Height
  Height := 0;
  Height := Height+File1.Top+File1.Height+10;
  //Res independent Form Width
  Width := 0;
  Width := (Width-ClientWidth)+(Bevel1.Left+Bevel1.Width+10);
end;

end.
