Hi,
I wanted to use a picture smaller than my form and tile it like on window's desktop. How can I do it?
Thanks.
Printable View
Hi,
I wanted to use a picture smaller than my form and tile it like on window's desktop. How can I do it?
Thanks.
Code:'tile an image on a form
'1) Place an image control on a form and give it a picture
'2) Set the forms AutoRedraw to False
'3) Place this code in the Form Paint Event
Dim intX As Integer
Dim intY As Integer
For intX = 0 To Me.Width Step Image1.Width
For intY = 0 To Me.Height Step Image1.Height
PaintPicture Image1, intX, intY
Next intY
Next intX
TRY THIS, ITS NOT MY WORK BUT IT WORKS FOR ME!
Just give it the form and the picture box with the bitmap and away it will go.
Obviously you will need to set autorefresh to true on the form if you want to keep the tile effect when another window
moves over it......
Public Function TileBitmap(ByVal TheForm As Form, ByVal theBitmap As PictureBox)
Dim iAcross As Integer
Dim iDown As Integer
theBitmap.AutoSize = True
For iDown = 0 To (TheForm.Width \ theBitmap.Width) + 1
For iAcross = 0 To (TheForm.Height \ theBitmap.Height) + 1
'===========This section should be all one line;-)=======
TheForm.PaintPicture theBitmap.Picture, iDown * theBitmap.Width, iAcross * theBitmap.Height, theBitmap.Width, theBitmap.Height
'========================================================
Next iAcross, iDown
End Function
See this topic