Results 1 to 12 of 12

Thread: [RESOLVED] Background picture "Cut off"

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    105

    Resolved [RESOLVED] Background picture "Cut off"

    I have a picture box that I want to use as a background image. The image i am pulling in is quite large and I want to scale it to fit the size of the user's screen. I have searched several threads but cannot get it to work! It gets cut off in places - the picture (which is way bigger than the box) is cut off by the size of the picturebox

    I tried to do things like

    picture1.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight

    or

    picture1.Move 0, 0, screen.Width, screen.Height

    but that makes it worse!
    help!

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    105

    Re: Background picture "Cut off"

    additional info:
    the screen is set to

    WindowState = vbMaximized

  3. #3
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Background picture "Cut off"

    You either have to paint the image yourself on the picturebox using the PaintPicture method or using the StretchBlt API function, or you could use an image box instead of a picture box and simply set the Stretch property to True.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    105

    Re: Background picture "Cut off"

    here is the code as it stands...

    Code:
            Image1.Picture = LoadPicture(App.path & "\licensed.jpg")
            Image1.Stretch = True
            Image1.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight
    and it doesnt work

    anyone?

  5. #5
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: Background picture "Cut off"

    Quote Originally Posted by VB rookie
    and it doesnt work
    It's doesn't work does not tell me what is wrong.

    I ran the code and it worked as expected for me.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    105

    Re: Background picture "Cut off"

    Quote Originally Posted by Negative0
    It's doesn't work does not tell me what is wrong.

    I ran the code and it worked as expected for me.
    sorry. it doesnt fill the entire screen window on a 17" monitor. Its fine on a 15" but I need it to maximize to any screen

  7. #7
    Cumbrian Milk's Avatar
    Join Date
    Jan 2007
    Location
    0xDEADBEEF
    Posts
    2,448

    Re: Background picture "Cut off"

    Dare I ask what 'Licensed.Jpg' actually is... can it be constructed? Also, if the image box is failing, StretchBlt (as Joacim suggests) will definitely work.

    However, the code works fine for me on my 17"... are you using this code in the load event without using me.show first?

  8. #8
    Fanatic Member drivenbywhat's Avatar
    Join Date
    Jan 2007
    Location
    VA - USA
    Posts
    866

    Re: Background picture "Cut off"

    Perhaps adding

    image.height = form1.height - 50 'fool around with #'s
    image.width = form1.width - 10

    to the other code you have will make it strecth properly?

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    105

    Re: Background picture "Cut off"

    i just looked at the dimensions of the pic (which is a background photo for the app btw) and they are about 1400x1000 (ish). Is that the problem - photo is too small?

    About this StretchBlt - i dont know how to use it... anyone with quick tutorial?

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    105

    Re: Background picture "Cut off"

    Quote Originally Posted by Milk
    Dare I ask what 'Licensed.Jpg' actually is... can it be constructed? Also, if the image box is failing, StretchBlt (as Joacim suggests) will definitely work.

    However, the code works fine for me on my 17"... are you using this code in the load event without using me.show first?
    Thanks Milk! Thats the difference!

    I always forget the difference between form_load and form_activate. Tsk tsk

  11. #11
    Hyperactive Member
    Join Date
    Oct 2006
    Posts
    403

    Re: Background picture "Cut off"

    VB Rookie,

    See my closely related query about picture boxes above in the forum list - last worked 6.24pm today 3/5/07.

    I was having exactly the same problems as you. My application is to display technical diagrams on the form from JPEG stored image files. Picture boxes would only show me the top left hand corner of my images. I needed the whole image. Solution found was to use the image control instead with stretch set to TRUE. However this results in odd az-el spacial distortion of the image unless the image height and width values are set correctly either at design or run time. What I have done is to settle on scanning my diagrams into jpeg images as square images, ie az = el dimension. But I then found that in order to display them as undistorted squares I had to set image height to 320 but image width to only 235. Am not sure why, but it works.

    Like you I am setting my form windowstate to 2 - vbmaximised - and I am using a 17 inch monitor. So far so good.

    I now would like to be able to zoom in on selected parts of this image in ever greater detail and display those sub-images on my VB form in image or picture boxes, but thus far have not found out how to do this. If you or any others have any ideas, I'd be very pleased to hear them.

    Regards,

    CAM

  12. #12

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    105

    Re: [RESOLVED] Background picture "Cut off"

    i have no suggestions for you camoore. Sorry man. Rookie, as the name implies

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