1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
| unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, jpeg;
type
TForm1 = class(TForm)
PaintBox1: TPaintBox;
Image1: TImage;
Label1: TLabel;
procedure FormResize(Sender: TObject);
procedure PaintBox1Paint(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Déclarations privées }
w,h:integer;
fond:tbitmap;
public
{ Déclarations publiques }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
width:=screen.Width div 2;
height:=screen.Height div 2;
position:=poscreencenter;
fond:=tbitmap.Create;
fond.assign(image1.Picture.Graphic);
end;
procedure TForm1.PaintBox1Paint(Sender: TObject);
begin
paintbox1.Canvas.stretchdraw(paintbox1.ClientRect,fond)
end;
procedure TForm1.FormResize(Sender: TObject);
begin
w:=form1.clientwidth;
h:=form1.ClientHeight;
with paintbox1 do begin
width:=w ;
height:=h;
left:=0;
top:=0
end;
end;
end. |
Partager