Board index » delphi » Tiled/Centered background image on Delphi Form

Tiled/Centered background image on Delphi Form

How can I create a tiled or centered bitmap on the back of a form?  I
can place a bitmap on the background, but if the form is larger than
the bitmap, it does not cover the whole back.  I do not want the
bitmap stretched, but tiled or centered.

Thanks in advance
Avallach

 

Re:Tiled/Centered background image on Delphi Form


Quote
Avallach wrote:

> How can I create a tiled or centered bitmap on the back of a form?  I
> can place a bitmap on the background, but if the form is larger than
> the bitmap, it does not cover the whole back.  I do not want the
> bitmap stretched, but tiled or centered.

> Thanks in advance
> Avallach

try

try

  Bitmap1: TBitmap;

  (on create)
  Bitmap1 := TBitmap.Create;
  Bitmap1 := MainForm.image1.picture.bitmap;

  (on paint)
  Form1.Canvas.Draw(width div 2, height div 2, Bitmap1);

  (on destroy)
  Bitmap1.Free;

marko...@EUnet.yu

Pedja from Beograd

Re:Tiled/Centered background image on Delphi Form


Quote
Avallach (avall...@geocities.com) wrote:

: How can I create a tiled or centered bitmap on the back of a form?  I
i don't know if this is the 'correct' way to handle it, but i would just
form.canvas.draw the bitmap in a x- and y- loop in the form.onPaint routine
until it fills the canvas.

: Thanks in advance
hth

: Avallach
  -- oly
--

+-------------------------------------------------------+
| Oliver Nittka                | nit...@esem.com        |
| ESEM Gruenau GmbH & Co. KG   | http://www.esem.com    |
| Riedheimer Str.6             | phone: +49 7544 71021  |
| 88677 Markdorf / Germany     | fax:   +49 7544 71024  |
+-------------------------------------------------------+

Other Threads