// Pada uses tambahkan (jpeg , vcl.extctrls)
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs,vcl.extctrls,jpeg;
type
TForm2 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.FormCreate(Sender: TObject);
var a:Timage ;
begin
a:=TImage.Create(nil) ;
a.Parent := Form2 ;
a.Align := alClient ; // agar komponen mengikuti lebar,tinggi form
//a.Proportional := true ; // agar image tampil menyesuaikan
a.Stretch := true ; // agar image mengikuti lebar komponen
a.Picture.LoadFromFile('D:\foto.jpg') ;
end;
end.
Tidak ada komentar:
Posting Komentar