unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtDlgs, StdCtrls, ExtCtrls, Jpeg;
type
TForm1 = class(TForm)
Image1: TImage;
Button1: TButton;
Button2: TButton;
OpenPictureDialog1: TOpenPictureDialog;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
if OpenPictureDialog1.Execute and FileExists(OpenPictureDialog1.FileName)then
Image1.Picture.LoadFromFile(OpenPictureDialog1.FileName);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
if Image1.Picture.Graphic is TBitmap then
ShowMessage('Bmp')
else if Image1.Picture.Graphic is TJPEGImage then
ShowMessage('Jpeg')
end;
end.