有多个方案,选一个贴来(楼上各位的方法也正确)
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,Jpeg;
type
TForm1 = class(TForm)
procedure FormPaint(Sender: TObject);
procedure FormCreate(Sender: TObject);
end;
var
Form1: TForm1;
jpg:TJpegimage;
implementation
{$R *.DFM}
procedure TForm1.FormPaint(Sender: TObject);
begin
self.Canvas.Draw(0,0,jpg);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
self.Canvas.Draw(0,0,jpg);
end;
initialization
jpg:=TJpegimage.Create;
jpg.LoadFromFile('1024x768_004.jpg');
finalization
jpg.Free;
end.