Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Visual Basic
Expertise: Beginner
Mar 23, 2000



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Tile With Lightweight Image Control Arrays

I write apps for companies where computer know-how is at an all-time low. Most applications scare people to death. However, Web-style forms and graphic buttons present soothing enough interfaces that they can be inviting to users.

I wanted my forms to look just like a Web page, so I devised a method to replicate and tile one Image control across a form. To achieve this effect, add an Image control to your form, set its Index to zero, set Visible to False, and set an appropriate background image for the Picture property. Pass your form to the CreateBackground routine during its Load event:
Private Sub Form_Load()
	Call CreateBackground(Me)
End Sub
Public Sub CreateBackground(frmCallingParent)
	Dim lTilesY As Long, lTilesX As Long
	Dim lLeft As Long, lTop As Long
	Dim oImg As Image
	Dim X As Integer
	Set oImg = frmCallingParent.Image1(0)
	lTilesX = oImg.Width
	lTilesY = oImg.Height
	Do While lTop < Screen.Height
		X = X + 1
		Load frmCallingParent.Image1(X)
		Set oImg = frmCallingParent.Image1(X)
		With oImg
			.Left = lLeft
			.Top = lTop
			.Visible = True
		End With
		lLeft = lLeft + lTilesX
		If lLeft > Screen.Width Then
			lLeft = 0
			lTop = lTop + lTilesY
		End If
End Sub
Craig R.
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date