|
-
May 1st, 2007, 02:44 PM
#1
Thread Starter
Lively Member
[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!
-
May 1st, 2007, 02:47 PM
#2
Thread Starter
Lively Member
Re: Background picture "Cut off"
additional info:
the screen is set to
WindowState = vbMaximized
-
May 1st, 2007, 04:47 PM
#3
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.
-
May 2nd, 2007, 02:07 PM
#4
Thread Starter
Lively Member
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?
-
May 2nd, 2007, 02:30 PM
#5
Re: Background picture "Cut off"
 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.
-
May 2nd, 2007, 02:47 PM
#6
Thread Starter
Lively Member
Re: Background picture "Cut off"
 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
-
May 2nd, 2007, 02:59 PM
#7
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?
-
May 2nd, 2007, 04:51 PM
#8
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?
-
May 3rd, 2007, 05:36 AM
#9
Thread Starter
Lively Member
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?
-
May 3rd, 2007, 11:14 AM
#10
Thread Starter
Lively Member
Re: Background picture "Cut off"
 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
-
May 3rd, 2007, 12:45 PM
#11
Hyperactive Member
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
-
May 4th, 2007, 05:17 AM
#12
Thread Starter
Lively Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|