Put a background on your form

 



Define a global variable type TBitmap to the whole form where we will load the image to put as background :

 

Var

   Form1       : TForm1 ;

   BackGround  : TBitmap ;

 

And the procedure :

 

Procedure TForm1.FormCreate ( Sender : TObject ) ;

Begin

   BackGround := TBitmap.Create ;

   BackGround.LoadFromFile ( 'c:\my documents\1.bmp' ) ;

End ;

 

Procedure TForm1.FormPaint ( Sender : TObject ) ;

Var

   row , column : Integer ;

Begin

 

   For row := 0 To Trunc ( Height / BackGround.Height ) Do

      For column := 0 To Trunc ( Width / BackGround.Width ) Do

         Canvas.Draw ( column * BackGround.Width , row * BackGround.Height , BackGround ) ;

End ;

 

Procedure TForm1.FormDestroy ( Sender : TObject ) ;

Begin

   BackGround.Free ;

End ;


Back Home Foward