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

Thread: Tile a picture

  1. #1
    Guest

    Tile a picture

    Hot to tile a picture as a background in a form like internet brousers?



  2. #2
    Join Date
    Nov 1999
    Location
    Virginia, US
    Posts
    11

    Re: Tile a picture

    Place an image control (Image1) on your form and assign the image you want tiled to its picture property. Set Image1.Visible to False. In the forms Paint event, call the TileBackground sub. Add the following sub to your form.
    Sub TileBackground()
    Dim x as Integer, y as Integer, iWidth as Integer, iHeight as Integer

    iWidth = Image1.Width
    iHeight = Image1.Height

    for x = 0 to Width step iWidth
    for y = 0 to Height step iHeight
    me.PaintPicture Image1.Picture, x, y
    next y
    next x
    End Sub


    This works just as well using a picturebox (as a container) instead of a form. Never tried it with a UserControl, but can't imagine why it wouldn't work there as well.

    -----
    Lee Perkins
    TigerBase Technologies

  3. #3

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