?
Solved

Expand a form to show all of picture

Posted on 2014-07-21
28
Medium Priority
?
142 Views
Last Modified: 2014-07-22
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
0
Comment
Question by:isnoend2001
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 14
  • 14
28 Comments
 
LVL 49

Expert Comment

by:Martin Liss
ID: 40211698
Me.Height = picShowPic(2).Height + picShowPic(2).Top + 50 + (Me.Height - Me.ScaleHeight) 'size the form
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 40211725
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
 

Author Comment

by:isnoend2001
ID: 40211813
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:isnoend2001
ID: 40211818
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 40211888
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
 
LVL 49

Expert Comment

by:Martin Liss
ID: 40211916
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
 

Author Comment

by:isnoend2001
ID: 40211930
thanks Martin Liss
I do not need the width adjusted only the form made taller.
Did you see the form i uploaded ?
0
 

Author Comment

by:isnoend2001
ID: 40211945
On the form i uploaded click cmdShowPic(1) then look at pic
click Command1 the form is shorter
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 40211947
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
 
LVL 49

Accepted Solution

by:
Martin Liss earned 2000 total points
ID: 40211954
On the form i uploaded click cmdShowPic(1) then look at pic
I can't without the whole project.
0
 

Author Closing Comment

by:isnoend2001
ID: 40211995
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
 
LVL 49

Expert Comment

by:Martin Liss
ID: 40212016
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
 

Author Comment

by:isnoend2001
ID: 40212062
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
 
LVL 49

Expert Comment

by:Martin Liss
ID: 40212104
OK, thanks, and now I understand.
0
 

Author Comment

by:isnoend2001
ID: 40212337
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
 
LVL 49

Expert Comment

by:Martin Liss
ID: 40212383
That attachment only contains the form again. If you want to attach a picture then just click this button.Click it
0
 

Author Comment

by:isnoend2001
ID: 40212410
I am curious the picture Was Included in a picture box on the form.
Was it not ?
0
 

Author Comment

by:isnoend2001
ID: 40212418
RoofPic.jpg
0
 

Author Comment

by:isnoend2001
ID: 40212464
I downloaded the zip and the image was included
click the button that says "click me" to show image
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 40212615
A person can only open the app if they have the non-vb controls on your PC and I don't.
0
 

Author Comment

by:isnoend2001
ID: 40212673
The only controls on the form are:
Picture box and command buttons.
You do not have these ?
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 40212827
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
 

Author Comment

by:isnoend2001
ID: 40213021
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
 
LVL 49

Expert Comment

by:Martin Liss
ID: 40213036
Hey I'm 73:)
0
 

Author Comment

by:isnoend2001
ID: 40213106
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
 
LVL 49

Expert Comment

by:Martin Liss
ID: 40213121
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
 

Author Comment

by:isnoend2001
ID: 40213140
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
 
LVL 49

Expert Comment

by:Martin Liss
ID: 40213146
Thanks. Given my age I'm glad I'm here too:)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month11 days, 13 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question