|
-
Mar 31st, 2001, 06:32 PM
#1
Thread Starter
Addicted Member
hello there
does anyone know how i can tile a picture as a bacground for a form, the picture might be small, but i either want to stretch it or tile it all over the form
Tell whoever has sorrow,
Grief shall never last
Just as joy has no tommorow,
Woe is bound not to last
 Estrelitta 
-
Mar 31st, 2001, 07:26 PM
#2
To tile a picture:
Code:
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Sub Form_Load()
AutoRedraw = True
Picture1.AutoRedraw = True
ScaleMode = 3
For x = 0 To Width Step Picture1.Width
For y = 0 To Height Step Picture1.Height
DoEvents
BitBlt hDC, x, y, Picture1.Width, Picture1.Height, Picture1.hDC, 0, 0, vbSrcCopy
Form1.Refresh
Next y
Next x
End Sub
-
Mar 31st, 2001, 07:29 PM
#3
Or:
Code:
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Sub Form_Load()
ScaleMode = 3
Picture1.AutoRedraw = True
End Sub
Private Sub Form_Paint()
For x = 0 To Width Step Picture1.Width
For y = 0 To Height Step Picture1.Height
DoEvents
BitBlt hDC, x, y, Picture1.Width, Picture1.Height, Picture1.hDC, 0, 0, vbSrcCopy
Next y
Next x
End Sub
-
Mar 31st, 2001, 07:33 PM
#4
And to stretch it.
Code:
Private Sub Form_Load()
AutoRedraw = True
End Sub
Private Sub Form_Resize()
PaintPicture Picture1, 0, 0, Width, Height
End Sub
-
Mar 31st, 2001, 08:06 PM
#5
Thread Starter
Addicted Member
thx a lot megatron, thats just exactly what i was looking for
Tell whoever has sorrow,
Grief shall never last
Just as joy has no tommorow,
Woe is bound not to last
 Estrelitta 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|