Expand a form to show all of picture

Private Sub Command1_Click()
picShowPic(2).AutoSize = True
Me.Height = picShowPic(2).Top + picShowPic(2).Height + 50 'size the form
Me.Top = Screen.Height / 2 - Me.Height / 2
End Sub
I cannot get the form to grow taller to display all the picturebox contents
what is wrong?
using vb6
isnoend2001Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
Me.Height = picShowPic(2).Height + picShowPic(2).Top + 50 + (Me.Height - Me.ScaleHeight) 'size the form
0
Martin LissOlder than dirtCommented:
And to show the whole picture and not just the height then do this instead of the above.

' The four parts of the following are Left, top, Width, height
Me.Move Me.Left, _
        Me.Top, _
        picShowPic(2).Width + picShowPic(2).Left + 50, _
        picShowPic(2).Height + picShowPic(2).Top + 50 + (Me.Height - Me.ScaleHeight)

Open in new window

0
isnoend2001Author Commented:
Thanks, Martin Liss, but the form does not grow taller to show the whole pic.
the bottom of the pic is cut off
See attached form
command1 runs the resizing
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

isnoend2001Author Commented:
0
Martin LissOlder than dirtCommented:
Attaching the frm and frx files are not enough for me to open the project but in the form you still have your old code

        picShowPic(2).AutoSize = True
        Me.Height = picShowPic(2).Top + picShowPic(2).Height + 50 'size the form
        Me.Top = Screen.Height / 2 - Me.Height / 2
0
Martin LissOlder than dirtCommented:
Here are before and after pictures. Please ignore what's in the pictures and take my word for it that the whole picture is shown.

The code I used was.

Private Sub Command1_Click()
picShowPic(2).AutoSize = True
'Me.Height = picShowPic(2).Height + picShowPic(2).Top + 50 + (Me.Height - Me.ScaleHeight) 'size the form
' The four parts of the following are Left, top, Width, height
Me.Move Me.Left, _
        Me.Top, _
        picShowPic(2).Width + picShowPic(2).Left + 50, _
        picShowPic(2).Height + picShowPic(2).Top + 50 + (Me.Height - Me.ScaleHeight)
Me.Top = Screen.Height / 2 - Me.Height / 2
End Sub

Open in new window

BeforeAfter
0
isnoend2001Author Commented:
thanks Martin Liss
I do not need the width adjusted only the form made taller.
Did you see the form i uploaded ?
0
isnoend2001Author Commented:
On the form i uploaded click cmdShowPic(1) then look at pic
click Command1 the form is shorter
0
Martin LissOlder than dirtCommented:
I did see the form but as I said I can't run it because you didn't include the whole project. In any case if you don't need to make the form wider then just do this.

Private Sub Command1_Click()
picShowPic(2).AutoSize = True
Me.Height = picShowPic(2).Height + picShowPic(2).Top + 50 + (Me.Height - Me.ScaleHeight) 'size the form
Me.Top = Screen.Height / 2 - Me.Height / 2
End Sub

Open in new window

0
Martin LissOlder than dirtCommented:
On the form i uploaded click cmdShowPic(1) then look at pic
I can't without the whole project.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
isnoend2001Author Commented:
Sorry martin i forgot about the activex Command buttons, but i think i found the issue I was showing index 1
was trying to adjust index 2. If i have more issues i will replace the the activex with vb buttons.The project is huge with tons of activex controls
0
Martin LissOlder than dirtCommented:
I'm confused. I assume that this is a VB6 project and if it is what do you mean when you say "i will replace the the activex with vb buttons"?
0
isnoend2001Author Commented:
The form i sent had these command buttons
 http://www.namtuk.com/MyCommandButton-for-ActiveX.aspx
to upload for you i would replace the array of MyButtons with vb command buttons
0
Martin LissOlder than dirtCommented:
OK, thanks, and now I understand.
0
isnoend2001Author Commented:
Thanks Martin Liss
I changed the command buttons, but for some reason the form will not go tall enough to show the whole pic
see attached
RoofPics.zip
0
Martin LissOlder than dirtCommented:
That attachment only contains the form again. If you want to attach a picture then just click this button.Click it
0
isnoend2001Author Commented:
I am curious the picture Was Included in a picture box on the form.
Was it not ?
0
isnoend2001Author Commented:
RoofPic.jpg
0
isnoend2001Author Commented:
I downloaded the zip and the image was included
click the button that says "click me" to show image
0
Martin LissOlder than dirtCommented:
A person can only open the app if they have the non-vb controls on your PC and I don't.
0
isnoend2001Author Commented:
The only controls on the form are:
Picture box and command buttons.
You do not have these ?
0
Martin LissOlder than dirtCommented:
I'm sorry but I didn't realize that you changed the form and if I change

        Me.Height = picShowPic(1).Height + picShowPic(1).Top + 50 'size the form

to

        Me.Height = picShowPic(1).Height + picShowPic(1).Top + 50 + (Me.Height - Me.ScaleHeight) 'size the form

it works. Is there anything else I can do for you?

BTW I need a pergola built for my patio. Do you want to do it?
0
isnoend2001Author Commented:
Thanks that fixed it
Re:
BTW I need a pergola built for my patio. Do you want to do it?
Thanks, but no I,m too old (66)
0
Martin LissOlder than dirtCommented:
Hey I'm 73:)
0
isnoend2001Author Commented:
Getting old sucks i dug a 50 ft waterline to garden last week took me 3 days instead of a few hours
Glad to be back using vb.I can kinda read vb code
Asked about 15 questions last week using jquery
To make this page:
http://roofgenius.com/Roof-Pitch-Calculator.asp
I read this line of code and thought "Are these people from earth"
t2 = ""||/^(\d+)?([.]?\d{0,2})?$/.test(text)===false?t2 = "Input Numbers Only":t2="";
0
Martin LissOlder than dirtCommented:
Lol, I hope there are comments, however back in the day (1985?) I used to program in APL which, believe it or not, stood for A Programming Language. Google APL is you want to see some complex code!
0
isnoend2001Author Commented:
At least vb reading kinda makes sense
L←S⌽(−(⍴L)+0,X)↑L    
    A←((1↑⍴L),X)↑L      
   N←0 1↓DLTB(0,X)↓L
Totally unreadable
Wish i knew as much about coding vb6 as i do roofing
When i had my roofing company i wrote a roof estimating program using Lotus123 and it was readable.
I am glad you are here
0
Martin LissOlder than dirtCommented:
Thanks. Given my age I'm glad I'm here too:)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.