tiled background images?

terminator2

Member
Licensed User
Longtime User
Hello,

Is it possible to set a background image to "tile" over and entire view? Basically I want to load one small image and have it seamlessly repeated over and entire panel like webpage background might.

Thanks,
Jim
 

terminator2

Member
Licensed User
Longtime User
Found this code here . Worked.

Sub drawBG (fname As String, vw As View)
Dim bpbg As Bitmap
bpbg.Initialize(File.DirAssets, fname)
Dim bp2 As Bitmap
bp2.InitializeMutable(vw.Width, vw.Height)
Dim cvbg As Canvas
cvbg.Initialize2(bp2)
Dim rs As Rect
Dim rd As Rect
rs.Initialize(0,0,bpbg.Width,bpbg.Height)
rd.Initialize(0,0,bpbg.Width,bpbg.Height)
Dim left As Int
Dim top As Int
left = 0
top = 0
Do While left < vw.Width
rd.left = left
rd.Right = rd.left + bpbg.Width
Do While top < vw.Height
rd.top = top
rd.Bottom = rd.top + bpbg.Height
cvbg.DrawBitmap(bpbg, rs, rd)
top = top + bpbg.Height
Loop
left = left + bpbg.Width
top = 0
Loop
vw.SetBackgroundImage(bp2)
End Sub
 
Upvote 0
Top