how to set a backdrop tiled on the form as a full background texture

Hi there,

I have a simple problem. I am setting a background on a form as a backdrop but the form height and width is bigger than the backdrop image.
I don’t like stretching the backdrop so I need it tiled to make a good pattern (texture)

My question therefor is:
-how to set a backdrop tiled to the form as a background?
-In which event does this need to be? (so that it also supports resizing the form?)

Many thanks in advance! Looking forward to your help!

pattern is the name of an image that I imported in to the IDE, so change it for your use…

[code]Sub Paint(g As Graphics, areas() As REALbasic.Rect)
#Pragma Unused areas

DIM tiledPattern As NEW Picture(self.Width, self.Height)
DIM rows As Integer = Ceil(self.Height / pattern.Height)
DIM columns As Integer = Ceil(self.Width / pattern.Width)

for i as Integer = 0 to (rows - 1)
for j as Integer = 0 to (columns - 1)
tiledPattern.Graphics.DrawPicture pattern, (j * pattern.Width), (i * pattern.Height)
next
next

g.DrawPicture tiledPattern, 0, 0
End Sub[/code]

Ok got it to work I also had to enable app.UseGDIPlus

app.UseGDIPlus = true
#Pragma Unused areas

dim tiledPattern As NEW Picture(self.Width, self.Height)
dim rows As Integer = Ceil(self.Height / UIKitBackground.Height)
dim columns As Integer = Ceil(self.Width / UIKitBackground.Width)

for i as Integer = 0 to (rows - 1)
for j as Integer = 0 to (columns - 1)
tiledPattern.Graphics.DrawPicture UIKitBackground, (j * UIKitBackground.Width), (i * UIKitBackground.Height)
next
next

g.DrawPicture tiledPattern, 0, 0

hmm when i now place controls on the form the render a white border. any idea?

Using a background image is not recommended in Windows. Xojo uses Win32-style windowing, which does a poor job compositing. There is a feature request pending to move to .NET style, but there is no timeline announced for it.