Results 1 to 6 of 6

Thread: [RESOLVED] image as a background

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2005
    Posts
    124

    Resolved [RESOLVED] image as a background

    How can I set an image to be the background of the form? (I.E. sent to back, so that all controls are still viewable)

    I want the image to be resived and strech as the form moves, so if the form as 400 by 400 the image would be to, if the form changes to 500 by 300 then i want the image to change to that too. Any one know how?

  2. #2
    Lively Member
    Join Date
    Apr 2006
    Location
    Planet Earth
    Posts
    64

    Re: image as a background

    why dont u use imagebox..set the .stretch = true..
    I'm Still learning!
    satisfied/not satisfied, PLEASE TAKE SOME TIME TO rate me accordingly.
    Ur opinions helps me to be better!


    Appreciation Triggers Another Good Deeds.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Dec 2005
    Posts
    124

    Re: image as a background

    Just noticed that, was about to reply here but seems you go to it first.

    One last question I want to hardcode the path name into the code, not chose it in design mode.

    How would I do this? This is the path name for the image "C:\windows\xp-800.jpg"

    but when I type this (in the Form_Load)
    VB Code:
    1. Me.Image1.Picture = "C:\windows\xp-800.jpg"

    I get mismatch error. Any ideas?

  4. #4
    Addicted Member
    Join Date
    Feb 2006
    Location
    The Sea of Tranquility
    Posts
    252

    Re: image as a background

    you need to use the loadpicture function

  5. #5
    Lively Member
    Join Date
    Apr 2006
    Location
    Planet Earth
    Posts
    64

    Re: image as a background

    VB Code:
    1. Image1.Picture = LoadPicture("C:\background.jpg")
    I'm Still learning!
    satisfied/not satisfied, PLEASE TAKE SOME TIME TO rate me accordingly.
    Ur opinions helps me to be better!


    Appreciation Triggers Another Good Deeds.

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,335

    Re: image as a background

    Place some kind of image in an image control on your form, and add this to the Form_Load and see what you think
    VB Code:
    1. Private Sub Form_Load()Dim tx As Integer
    2.    Dim ty As Integer
    3.    Dim tw As Integer
    4.    Dim th As Integer
    5.    Dim pw As Long
    6.    Dim ph As Long
    7.    Form1.AutoRedraw = True
    8.    tw = Int(Form1.Width / Image1.Width) + 1
    9.    th = Int(Form1.Height / Image1.Height) + 1
    10.    pw = Image1.Width
    11.    ph = Image1.Height
    12.  
    13.    For tx = 0 To tw
    14.       For ty = 0 To th
    15.          Form1.PaintPicture Image1.Picture, tx * pw, ty * ph
    16.       Next ty
    17.    Next tx
    18.  
    19.    Form1.AutoRedraw = False
    20.    Image1.Visible = False
    21. End Sub

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