CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2000
    Location
    Ohio
    Posts
    31

    Form Background picture

    Hi all,
    I am trying to create a form that has a background image (texure),but I don't want to use the picture or the image controls (they a lot of time when loading the form). I did try to use the picture property of the Form, but my problem is that I want the texure to cover the whole background of the form; even when I resize it. Is there a way to do that, I am can I tile a small picture to cover the form; I don't want to strech it, because the image looks very bad when the I maximize the form.
    thank in advance


  2. #2
    Guest

    Re: Form Background picture

    well, if you dont want the person to resize the form do this:
    'be sure to disable the maximize feature
    'set the timers interval to 1

    If Form1.Height > 2775 Then
    Form1.Height = 2775
    End If
    If Form1.Width > 5550 Then
    Form1.Width = 5550
    End If



  3. #3
    Join Date
    Jan 2000
    Location
    MO, USA
    Posts
    1,506

    Re: Form Background picture

    I use this code to paint a picture across the form. I have one picture box on the form, but i'm not tiling that control, just the contents of it.

    private Sub Form_Load()

    With Picture1
    .AutoSize = true
    .BorderStyle = 0
    .Visible = false
    End With

    End Sub

    private Sub Form_Paint()
    Dim i as Long, j as Long

    With Picture1
    for i = 0 to me.ScaleWidth step .Width
    for j = 0 to me.ScaleHeight step .Height
    me.PaintPicture .Picture, i, j
    next j
    next i
    End With

    End Sub

    private Sub Form_Resize()
    me.Refresh
    End Sub




    This works, and works fast too. It handles maximizing and resizing without a problem.

    Hope this helps,
    John

    John Pirkey
    MCSD
    www.ShallowWaterSystems.com
    John Pirkey
    MCSD (VB6)
    http://www.stlvbug.org

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