Results 1 to 6 of 6

Thread: [RESOLVED] Size of child forms in MDIParent

  1. #1

    Thread Starter
    Lively Member VisualBrian's Avatar
    Join Date
    Nov 2019
    Location
    North America
    Posts
    72

    Resolved [RESOLVED] Size of child forms in MDIParent

    Is it possible to code a child form larger than the parent form? When I try the child is resized to approx the parent client size.
    I may not know anything, but I know it well!

  2. #2
    Fanatic Member
    Join Date
    Jul 2022
    Location
    Buford, Ga USA
    Posts
    629

    Re: Size of child forms in MDIParent

    Are you trying to get scroll bars on the parent to then allow the user to move around this larger child?

    Edit: this is a crude example, but it seems to work as expected
    Code:
    Public Class Form1
        Private Sub LoadChildToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles LoadChildToolStripMenuItem.Click
    
            Dim frm As New Form
    
            With frm
                .Name = "frmTest"
                .Width = Me.Width + 1000
                .Height = Me.Height + 1000
                .Text = "Test Childform width: " & .Width.ToString() & " height: " & .Height.ToString()
                .MdiParent = Me
                .Show()
            End With
    
        End Sub
    
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    
            Me.Text = "MDI Parent width:" & Me.Width.ToString() & " height: " & Me.Height.ToString()
    
        End Sub
    
        Private Sub Form1_Resize(sender As Object, e As EventArgs) Handles MyBase.Resize
            Me.Text = "MDI Parent width:" & Me.Width.ToString() & " height: " & Me.Height.ToString()
            Application.DoEvents()
    
        End Sub
    End Class
    edit2: added screen size info, the scrollbars added to the parent automatically look to not accurately represent the difference in size. Maybe that is the issue.
    Last edited by jdelano; Jan 2nd, 2025 at 08:59 AM.

  3. #3

    Thread Starter
    Lively Member VisualBrian's Avatar
    Join Date
    Nov 2019
    Location
    North America
    Posts
    72

    Re: Size of child forms in MDIParent

    Thanks jdelano but no. I'm trying to make the child form larger than the parent form when the parent form is maximized, create any form larger than the screen res (mine being 1920 x 1080). I can place a panel or browser on the form that is say... 2000 x 2000, but it's not allowed with a form. I know it's a program or windows restriction but is there a way to code around it?
    I may not know anything, but I know it well!

  4. #4
    Fanatic Member
    Join Date
    Jul 2022
    Location
    Buford, Ga USA
    Posts
    629

    Re: Size of child forms in MDIParent

    Ah, yeah kinda locked there by the resolution.

  5. #5

    Thread Starter
    Lively Member VisualBrian's Avatar
    Join Date
    Nov 2019
    Location
    North America
    Posts
    72

    Resolved Re: Size of child forms in MDIParent

    Yes, the "creation" of a form is restricted by the resolution, but I found a workaround that works for me. By placing a 2 x 3000 panel on the left side of the form and placing 3000 x 2 panel on the top of the form (not docked but simply located at 0, 0) and setting the AutoScroll for the form to true, I was able to get a 3000 x 3000 child form within the MDIParent. This allows me to place my controls on the form where my current code will work properly, instead of on a panel, and I only loose a couple of pixels.
    I may not know anything, but I know it well!

  6. #6
    Fanatic Member
    Join Date
    Jul 2022
    Location
    Buford, Ga USA
    Posts
    629

    Re: [RESOLVED] Size of child forms in MDIParent

    Nice work!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width