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
Waiting for a full featured smart phone with out marrying a provider
Go Android
Go raiders
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.
The user may have multiple monitors. The Screen object only returns metrics for the primary monitor and these do not take Toolbars (such as the Taskbar) into account.
The user might change things during program execution such as the height of caption bars and thickness of borders. He might even drag the window from the first monitor it was open on to another monitor or change the resolution of the current monitor.
Unless you want to address all of these issues you are far better off letting the user resize your Forms and then adjust your controls to fit within the available client area.
Thanks
I think I will give a option to This Program best viewed in 1280x 800 and let the user resize the forms, but i want the whole pic to be visible in 1280x800
Waiting for a full featured smart phone with out marrying a provider
Go Android
Go raiders
thanks MarkT
But that does not work. The bottom of the pic is cut off.
The width is fine only need to adjust form height so all of pic shows
How big is your picture? Keep in mind there are limits to form sizes. Can you attach a stripped down version of your app that shows your problem? The code I posted works fine on my machine.
Sub CenterPic(Index As Integer)
picShowPic(Index).Top = picContainer.Top + picContainer.Height + lblShowPic.Height + 200
picShowPic(Index).Left = Me.ScaleWidth / 2 - picShowPic(Index).Width / 2
picShowPic(Index).Visible = True
' if you want padding under the image add a little extra
Me.Height = picShowPic(Index).Top + picShowPic(Index).Height + (Me.Height - Me.ScaleHeight)
End Sub
If this doesn't work then there is some kind of difference between your machine and mine that is causing problem. If on the other hand it does work then you need to try and find where you missed the changes I told you about.
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.