Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ressize/size MDI with picture box

Status
Not open for further replies.

UncleCake

Technical User
Feb 4, 2002
355
US
Hi,

I am trying to load a new MDI form with a picture box that should fill the whole form. I can't get it to size correctly when the form is loaded. In addition, I want to be able to resize the picture when the form is resized. Hi,

I am trying to load a new MDI form with a picture box that should fill the whole form. I can't get it to size correctly when the form is loaded. In addition, I want to be able to resize the picture when the form is resized. I think that one of my main problems are that I do not understand the difference between width and scalewidth. If you could offer any insight I would be very grateful.

Here where I load the form:
Private Sub loadChild(ByVal FileName As String)
Dim nForm As New frmChild
With nForm
.picMain.Picture = LoadPicture(FileName)
.Caption = FileName
.Show
.Top = .ScaleTop
.Left = .ScaleLeft
.Width = .picMain.Width
.Height = .picMain.Height
End With
End Sub

Here is my resize routine, I have the code commented out because I can't even get the first part to work.

Public Sub FormResize(ByRef myForm As frmChild)
With myForm
' .Width = .picMain.Width
' .Height = .picMain.Height
' .picMain.Width = .ScaleWidth
' .picMain.Height = .ScaleHeight
' .picMain.Left = .ScaleLeft
' .picMain.Top = .ScaleTop
End With

End Sub


Thanks,
-Uncle Cake
 
Hello

Try the following
Code:
Private Sub loadChild(ByVal FileName As String)
    Dim nForm As New frmChild
    With nForm
        .picMain.Picture = LoadPicture(FileName)
        .picMain.Align = vbAlignTop
        .picMain.Align = .height
        .Caption = FileName
        .Show
    End With
End Sub

Public Sub FormResize(ByRef myForm As frmChild)
    With myForm
        .picMain.Align = vbAlignTop
        .picMain.Height = .Height
    End With
End Sub

That should be all you need


Hope that helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top