|
|
Title | Tile an MDIForm's background |
Keywords | MDI, MDIForm, background, tile |
Categories | Tips and Tricks, Graphics |
|
|
Put a PictureBox named picHidden on the MDIForm and set its Visible property to False. Put another PictureBox named picTile in picHidden and give it the tile picture you want.
When the MDIForm resizes, resize picHidden so it is large enough to cover the MDIForm.
When picHidden resizes, tile the picture onto picHidden. Then copy the picHidden.Picture to the MDIForm's Picture property.
|
|
Private Sub MDIForm_Resize()
' Make picHidden fill the MDI form.
picHidden.Move 0, 0, Width, Height
End Sub
' Tile the MDI form.
Private Sub picHidden_Resize()
Dim X As Single
Dim Y As Single
' Tile picHidden.
Y = 0
Do While Y <= picHidden.ScaleHeight
X = 0
Do While X <= picHidden.ScaleWidth
picHidden.PaintPicture picTile.Picture, X, Y, _
picTile.ScaleWidth, picTile.ScaleHeight
X = X + picTile.ScaleWidth
Loop
Y = Y + picTile.ScaleHeight
Loop
Picture = picHidden.Image
End Sub
|
|
|
|
|
|