Click to See Complete Forum and Search --> : Tile a picture


November 28th, 1999, 04:05 PM
Hot to tile a picture as a background in a form like internet brousers?

leep
November 28th, 1999, 04:31 PM
Place an image control (Image1) on your form and assign the image you want tiled to its picture property. Set Image1.Visible to False. In the forms Paint event, call the TileBackground sub. Add the following sub to your form.
Sub TileBackground()
Dim x as Integer, y as Integer, iWidth as Integer, iHeight as Integer

iWidth = Image1.Width
iHeight = Image1.Height

for x = 0 to Width step iWidth
for y = 0 to Height step iHeight
me.PaintPicture Image1.Picture, x, y
next y
next x
End Sub


This works just as well using a picturebox (as a container) instead of a form. Never tried it with a UserControl, but can't imagine why it wouldn't work there as well.

-----
Lee Perkins
TigerBase Technologies

czimmerman
November 28th, 1999, 10:54 PM
See http://www.freevbcode.com/ShowCode.ASP?ID=18