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.
Printable View
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.
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
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.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
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?
Ah, yeah kinda locked there by the resolution.
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.
Nice work!