Results 1 to 5 of 5

Thread: backgrounds

  1. #1

    Thread Starter
    Addicted Member Ester's Avatar
    Join Date
    Feb 2001
    Posts
    148
    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

  2. #2
    Guest
    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

  3. #3
    Guest
    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

  4. #4
    Guest
    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

  5. #5

    Thread Starter
    Addicted Member Ester's Avatar
    Join Date
    Feb 2001
    Posts
    148

    Thumbs up

    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
  •  



Click Here to Expand Forum to Full Width