Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 150
  • Last Modified:

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
0
isnoend2001
Asked:
isnoend2001
  • 14
  • 14
1 Solution
 
Martin LissRetired ProgrammerCommented:
Me.Height = picShowPic(2).Height + picShowPic(2).Top + 50 + (Me.Height - Me.ScaleHeight) 'size the form
0
 
Martin LissRetired ProgrammerCommented:
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
isnoend2001Author Commented:
0
 
Martin LissRetired ProgrammerCommented:
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 LissRetired ProgrammerCommented:
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 LissRetired ProgrammerCommented:
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 LissRetired ProgrammerCommented:
On the form i uploaded click cmdShowPic(1) then look at pic
I can't without the whole project.
0
 
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 LissRetired ProgrammerCommented:
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 LissRetired ProgrammerCommented:
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 LissRetired ProgrammerCommented:
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 LissRetired ProgrammerCommented:
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 LissRetired ProgrammerCommented:
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 LissRetired ProgrammerCommented:
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 LissRetired ProgrammerCommented:
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 LissRetired ProgrammerCommented:
Thanks. Given my age I'm glad I'm here too:)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 14
  • 14
Tackle projects and never again get stuck behind a technical roadblock.
Join Now