I have a picture within a form which has an HScroll and VScroll scroll bars but the size of the thumb or slider isn't proportional to the missing portion of the picture.
I know it has to do with the
HScroll1.SmallChange
HScroll1.LargeChange
VScroll1.SmallChange
VScroll1.LargeChange
variables but I just don't understand them. No matter what I do to test on them it doesn't make sense.
Basically I need the variables to be a function of the form size and the picture size. ie form1.height/picture1.height
At the same time can someone explain what the difference between picture.height and picture.scaleheight?
It sounds like you need to set the scroll bars max and min properties to reflect the image size... the small change is the value change when you click the arrow and the large change is the value change when you click between the arrow and the slider
I found some code on microsoft's web site for adding scroll bars to a picture. Here is the link to the thread. I still don't understand how to modify it to get it working correctly. They have
VB Code:
HScroll1.Max = Picture1.Width - VScroll1.Left
VScroll1.Max = Picture1.Height - HScroll1.Top
Has anyone any suggestions on how to change it so that it starts with a long slide bar as soon as form1.width<picture1.width?
At the same time can someone explain what the difference between picture.height and picture.scaleheight?
You can change the scale, and it won't change the actual size of the picturebox.
Scale is used the set the "virtual" size of the picturebox
For example, if you have a picturebox with height 100, you can set it's ScaleHeight to 1000, then any object that you put INSIDE the picturebox, will have a size depending on it's scale, so if you put another object inside the picturebox, and you make it the same size as the picturebox, then it's height will be 1000 because it's parent picturebox has it's scale to 1000.
Anyways, I also attached a picture, maybe you will understand better when you actually see the sample numbers...
Thanks for looking at it but I still need some adjustments.
Attached is the original.
With the original the scroll bars are not visible until the size of the form is less than the size of the picture. This is what I want. But the problem is that as soon as the form is smaller than the picture the sliders appear but are about 1/5 of the size of the form. I'd like it so that that as when the form is a little bit smaller than the size of the picture, the sliders appear but are almost the length of the form and reduce when the form is resized smaller. Can you please look at it again?
Last edited by sgrya1; Nov 29th, 2006 at 06:19 AM.
Is anyone able understand what is wrong with the slider code? It's driving me nuts.
Below is the explaination for the paramaters but it seems that they are bugged. No matter what I change it doesn't do what I think it should.
Parameters
Min Usually set to zero or one
Max Set this to the number of rows in the file minus the number of rows displayed. If you want to scroll past the last row, then set it larger.
Value Where the slider is located.
LargeChange Amount Value is changed when the user clicks above or below the slider, or presses PgUp or PgDn keys.
SmallChange Amount Value is changed when the user clicks an arrow or presses the up and down arrow keys.
I finally understand what you wanted, you want to scroll when the form is smaller than the picture, not the other way around (as I originally understood)
But it looks OK to me...
I made the SmallChange and LargeChange static, maybe that's the result you want, take a look
I also placed some lines in the picture box, to be able to actually see it moving around
Not sure why this bug is occuring. Hoping you can help me out again.
Every now and again when I switch to a different application I come back to my progam to find that I get an error saying run-time error "380"
"Invalid Property Value"
When I press the debug button it flags
VScroll1.LargeChange = Picture1.Height - VScroll1.Max
as being the problem.
I'd like to shell down my program to show it to you but was wondering if you had any ideas before I try.