Tiling a picture in container picture box

How do I tile a picture in a container picturebox and not cover up the controls within the picture box?
VBStarterAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Erick37Connect With a Mentor Commented:
If the ClipControls property is True in the Picturebox, then the other controls wil not be drawn over.

EX:

Private Sub Form_Load()
    Picture1.Picture = LoadPicture("c:\windows\bubbles.bmp")
    Picture1.AutoRedraw = True
    Dim h As Long, w As Long
    Dim dx As Single, dy As Single
    dx = ScaleX(Picture1.Picture.Width, vbHimetric, vbTwips)
    dy = ScaleY(Picture1.Picture.Height, vbHimetric, vbTwips)
    For w = 0 To Picture1.Width Step dx
        For h = 0 To Me.Height Step dy
            Picture1.PaintPicture Picture1.Picture, w, h
        Next
    Next
End Sub
0
 
VBStarterAuthor Commented:
Thanks alot!  Maybe one day I can learn to program in VB.
0
 
Erick37Commented:
You're welcome.

Please note a typo in the code:

¬†For h = 0 To Me.Height Step dy <<--  Should be Picture1.Height
0
All Courses

From novice to tech pro — start learning today.