I tried 
put this in a module
Code:
Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Public Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
Public Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Public Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long
Public Const SRCCOPY = &HCC0020 ' (DWORD) dest = source
those are the declares...
put this in a module too, it doesnt matter if its the same module:
Code:
Public Function TileImage(RefForm As Form, ImageToTile As PictureBox) As Boolean
On Error GoTo error_TileImage
Dim lngBitmapHandle As Long
Dim lngFormHeight As Long
Dim lngFormWidth As Long
Dim lngPictureHeight As Long
Dim lngPictureWidth As Long
Dim lngPrevScale As Long
Dim lngRet As Long
Dim lngSourceDC As Long
Dim lngX As Long
Dim lngY As Long
If Not RefForm Is Nothing And Not ImageToTile Is Nothing Then
With ImageToTile
lngPrevScale = .ScaleMode
.ScaleMode = vbPixels
lngPictureHeight = .ScaleHeight
lngPictureWidth = .ScaleWidth
.ScaleMode = lngPrevScale
End With
With RefForm
lngPrevScale = .ScaleMode
.ScaleMode = vbPixels
lngFormHeight = .ScaleHeight
lngFormWidth = .ScaleHeight
.ScaleMode = lngPrevScale
End With
lngSourceDC = CreateCompatibleDC(RefForm.hdc)
lngBitmapHandle = SelectObject(lngSourceDC, ImageToTile.Picture.Handle)
For lngX = 0 To lngFormWidth Step lngPictureWidth
For lngY = 0 To lngFormHeight Step lngPictureHeight
lngRet = BitBlt(RefForm.hdc, lngX, lngY, lngPictureWidth, lngPictureHeight, lngSourceDC, 0, 0, SRCCOPY)
Next lngY
Next lngX
lngRet = SelectObject(lngSourceDC, lngBitmapHandle)
lngRet = DeleteDC(lngSourceDC)
TileImage = True
Else
TileImage = False
End If
Exit Function
error_TileImage:
If Not RefForm Is Nothing Then
RefForm.Tag = Err.Number & " " & Err.Description
End If
TileImage = False
End Function
put this in the declarations section of your form.
Code:
Sub SetTile()
On Error GoTo error_SetTile
Dim blnRet As Boolean
blnRet = TileImage(Me, picTile)
Screen.MousePointer = vbDefault
Exit Sub
error_SetTile:
Screen.MousePointer = vbDefault
End Sub
and in the form load put this
add a picturebox called picTile, set autosize to true, and have no borders, and set it out of site.
viola
it works good.. but it doesnt redraw itself when you resize, I tried setting autoredraw to true... no luck
I tried putting
in the forms resize, but still no luck, if you maximize it, about 1/3 of the it is blank...