William
When I use (in the Paint event of my desktop window)
Var b As New PictureBrush(img)
from your kindly provided code (with change of picture name and location) I get the error:
Window1.Paint, line 7
Too many arguments: got 1, expected only 0.
Var b As New PictureBrush(img)
Since it didn’t like the parameter, I guessed:
Var b As New PictureBrush
b.Image = cork
b.Mode = PictureBrush.Modes.Tile
and it worked fine.
(my background is named “cork” in the window backdrop property and “cork-board.png”)
Here is the code I ended up using:
Var img As Picture = Picture.Open(SpecialFolder.Documents.Child(“cork-board.png”))
// Or if you already assigned a Backdrop to your Window
img = self.Backdrop
If img <> Nil Then
'Var b As New PictureBrush(img)
Var b As New PictureBrush
b.Image = img
b.Mode = PictureBrush.Modes.Tile
g.Brush = b
g.FillRectangle(0, 0, g.Width, g.Height)
End If
I don’t know why I had to use both methods, the Picture.Open and self. Backdrop, but neither works by itself (for me).
You have solved my problem, but, if you have another minute, I’d love to know why one way worked and the other didn’t.
Thank you very much for your trouble.
fritz