CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Guest

    Mosaic BMP files

    Does anyone know how to mosaic BMP files to be the background of my form? I am making an RPG and this is vital to the game. thanks


  2. #2
    Guest

    Re: Mosaic BMP files

    Use Bitblt (Windows API) in a loop. They should have somethiing about bitblt on this site. Use it like

    for horizontal = 0 to screen.width
    for vertical = 0 to screen.height
    ' bitblt your picture here
    next vertical
    next horizontal



    This process is called tiling and you can find numerous articles about it on the net.



  3. #3
    Join Date
    May 1999
    Location
    Omika, Japan
    Posts
    729

    Re: Mosaic BMP files

    Have a form with AutoRedraw Property set to False.
    Add a image control to it and set its Picture property to the BMP that you want to tile on the form. Then out this repaint code

    private Sub Form_Paint()
    Dim ii as Long, jj as Long
    Dim lpPic as Picture, wid as Long, hgt as Long
    With Image1
    set lpPic = .Picture
    wid = .Width
    hgt = .Height
    End With
    ii = 0: jj = 0
    Do
    ii = 0
    Do
    me.PaintPicture lpPic, ii, jj
    ii = ii + wid
    Loop While ii < me.Width
    jj = jj + hgt
    Loop While jj < me.Height
    End Sub




    RK

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

Featured