Hot to tile a picture as a background in a form like internet brousers?
Printable View
Hot to tile a picture as a background in a form like internet brousers?
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