Solved

Expand a form to show all of picture

Posted on 2014-07-21
28
135 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
  • 14
  • 14
28 Comments
 
LVL 46

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 46

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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

Author Comment

by:isnoend2001
ID: 40211818
0
 
LVL 46

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 46

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 46

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 46

Accepted Solution

by:
Martin Liss earned 500 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 46

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 46

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 46

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 46

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 46

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 46

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 46

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 46

Expert Comment

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

Featured Post

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

770 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