Author : Teguh
Date Submitted : 11/30/2006
Category : Graphics
Compatibility : VB 6
This code has been accessed 5517 times.
Task : Tile a Picture on a Form
Declarations
Code
'Build a small Command Button and a PictureBox
Private Sub Command1_click()
On Error Resume Next
Me.Width = Screen.Width
Me.Height = Screen.Height
Me.Left = 0
Me.Top = 0
On Error GoTo ErrHandler
kembali:
On Error GoTo ErrHandler
Dim xFileName As Variant
xFileName = InputBox("Picture File Location ? (BMP,JPG,GIF,ICO)", , "C:\Tes.bmp")
If xFileName = "" Then Exit Sub
If Dir(xFileName) = "" Then MsgBox "Not Valid File Name !": GoTo kembali
Me.AutoRedraw = True
Picture1.AutoSize = True
Picture1.Visible = False
Picture1.Picture = LoadPicture(xFileName)
For a = 0 To Me.Width Step Picture1.Width
For b = 0 To Me.Height Step Picture1.Height
Me.PaintPicture Picture1, a, b
Next
Next
MsgBox "Done !"
Exit Sub
ErrHandler:
MsgBox Err.Description
End Sub