Arrange child form in MDI form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • muddasirmunir
    Contributor
    • Jan 2007
    • 284

    Arrange child form in MDI form

    Let me try to explain what I want to achieve.

    I had one MDI Form and I had putted child form in that. Now I want to arrange child form in MDI form in such a way that it always expend to such extent that it just left few margin at top,right,left and bottom.

    It might be similar to center form, but it also include height and widht of the form so even if i medium the size of MDI child form auto resize. Just like you can see in any softwares.

    You can also say it like box in a box. Hope you understand what i mean.

    I would prefer some function so i can use it many places.
  • muddasirmunir
    Contributor
    • Jan 2007
    • 284

    #2
    I think the code might work like that

    Code:
    form1.width=whatever
    form1.height=whatever
    
    form1.top=(screen.height-form1.height)/2
    
    form1.left=(screen.width-form1.width)/2
    I am confused, how to control widhth and height

    Comment

    • Guido Geurs
      Recognized Expert Contributor
      • Oct 2009
      • 767

      #3
      This is the code to set the values for the form and center it.
      Just addapt the values to your own needs.
      Code:
      Private Sub MDIForm_Resize()
         With Me
            If .Width - 1200 > 0 Then
               Form1.Width = .Width - 1200
               Form1.Left = 600 - 90
            Else
               .Width = 4500
            End If
            If .Height - 1200 > 0 Then
               Form1.Height = .Height - 1200
               Form1.Top = 600 - 120
            Else
               .Height = 4500
            End If
         End With
      End Sub

      Comment

      Working...