hello everyone.
i have a problem with MDI parent.in my project there is parent form and child form. in my MDi parent form i had created fix layout panel where i want to show the other child form . but i dot no how to call child form on that fix MDI panel form

hello everyone.
i have a problem with MDI parent.in my project there is parent form and child form. in my MDi parent form i had created fix layout panel where i want to show the other child form . but i dot no how to call child form on that fix MDI panel form

Would you like to show the child form in the fixed panel? I am not sure what exactly you want to do here. I the child needs to fit into the panel, its a matter of form resize codes, else, please send us more details to assist you.

Did you place a picture box on the mdi parent form and hope to show a mdi child form in it??? If so, the SetParent API is what you are looking for. If not, are you sure you set the mdichild propert to true in the intended child form???

Good Luck

in my mdi form i had created two fix panel on form show the child form and another small panel i'm showing the help of that particular form. i want to show only the form on that first fix panel. so i'm using the code like this tell me is this a write code for that

dim frm as new form1
panel1.Controls.Add(frm)
frm.show()

it show the child form
but it does not fit on he panel. what to do now.

As I suspected before, it is all a matter of resizing code. You need to specify the size of the form as well as the position by using the following -

With Form2
.Height = xxxx
.Width = xxxx
.Top = xxxx

etc. Play around with resizing codes, especially if you have users that have different screen resolutions and sizes etc.

If you do not want a user to resize the form, use the panel sizes to fit the form itself. It will not really "fit" into the panel, although that is what the user will see -

With form2
.Width = panel1.Width - 100 'To cover for any borders
.Top = panel1.Top - xxxx 'How ever high you want the form

I hope this helps towards your solution.

huunnn, i tihnk it will work. let me try . but thanks for the help sir

execuse me, i am newer, but I hope it's work. B-cause some time i get code from friends forums. And forgive me if this code it's has yours.
so try this....

Public Sub TB_Zone(frm As Form, Optional vntUseScaleValues As Variant)
    Dim bUseScaleValues As Boolean
    If Not IsMissing(vntUseScaleValues) Then
        bUseScaleValues = vntUseScaleValues
    End If
    With frm
        If bUseScaleValues Then
            TB_ZoneLeft = .ScaleLeft + .Left
            TB_ZoneTop = .ScaleTop + .Top
            TB_ZoneWidth = .ScaleWidth
            TB_ZoneHeight = .ScaleHeight
        Else
            TB_ZoneLeft = .Left
            TB_ZoneTop = .Top
            TB_ZoneWidth = .Width
            TB_ZoneHeight = .Height
        End If
    End With
End Sub

Public Sub TB_CenterForm(frm As Form, Optional vntOffsetLeft As Variant, Optional vntOffsetTop As Variant, Optional vntConsiderTaskbar As Variant)
    Dim lLeft As Long, lTop As Long
    Dim lOffsetLeft As Long
    Dim lOffsetTop  As Long
    Dim bConsiderTaskbar As Boolean
    
    If Not IsMissing(vntOffsetLeft) Then
        lOffsetLeft = vntOffsetLeft
    End If
    If Not IsMissing(vntOffsetTop) Then
        lOffsetTop = vntOffsetTop
    End If
    If Not IsMissing(vntConsiderTaskbar) Then
        bConsiderTaskbar = vntConsiderTaskbar
    End If
    With frm
        If .WindowState = vbNormal Then
            If bConsiderTaskbar Then
            ElseIf TB_ZoneWidth + TB_ZoneHeight > 0 Then
                lLeft = (TB_ZoneLeft + (TB_ZoneWidth \ 2)) - (.Width \ 2) + lOffsetLeft
                lTop = (TB_ZoneTop + (TB_ZoneHeight \ 2)) - (.Height \ 2) + lOffsetTop
                If lLeft + .Width > Screen.Width Then
                    lLeft = Screen.Width - .Width
                ElseIf lLeft < 0 Then
                    lLeft = 0
                End If
                If lTop + .Height > Screen.Height Then
                    lTop = Screen.Height - .Height
                ElseIf lTop < 0 Then
                    lTop = 0
                End If
            Else
                lLeft = ((Screen.Width - .Width) \ 2) + lOffsetLeft
                lTop = (((Screen.Height - .Height) \ 2) + lOffsetTop)
            End If
            If .Left = lLeft And .Top = lTop Then
            Else
                .Move lLeft, lTop
            End If
        End If
    End With
End Sub
Option Explicit
Public TB_ZoneLeft          As Long
Public TB_ZoneTop           As Long
Public TB_ZoneWidth         As Long
Public TB_ZoneHeight        As Long

Private Sub CenterMDIForm()
    Dim lLeft       As Long
    Dim lTop        As Long
    Dim iTemp       As Integer
    Dim sTemp       As String
    Static bOnTop   As Boolean
            TB_Zone Main_Form ' MDI Names
            TB_CenterForm Me, lLeft, lTop
End Sub

<URL SNIPPED>

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.