CodeItBetter Programming Another VB Programming Blog

How to insert a tiled picture inside a frame

Posted on January 4, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
'Controls - How to insert a tiled picture inside a frame
'Place a Picturebox on that frame (named Picture1) and another Picturebox 
'(named picBuffer). Change picBuffer Picture property to a desired picture 
'and AutoSize property to TRUE.

Put this on Picture1_Paint event:
 
Private Sub Picture1_Paint()
    Dim X As Integer, Y As Integer
    Dim iImgWidth As Integer
    Dim iImgHeight As Integer
    Dim iPicWidth As Integer
    Dim iPicHeight As Integer
 
    picBuffer.Visible = False
    ScaleMode = vbPixels
 
    iImgWidth = picBuffer.Width
    iImgHeight = picBuffer.Height
    iPicWidth = Picture1.Width
    iPicHeight = Picture1.Height
 
    For X = 0 To iPicWidth Step iImgWidth
        For Y = 0 To iPicHeight Step iImgHeight
            Picture1.PaintPicture picBuffer.Picture, X, Y
        Next Y
    Next X
End Sub
Filed under: Controls Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.