I have a VB.NET app that uses lots of forms which I am loading into a panel
cotrol using.....
Me.pnlMain.Cont rols.Clear()
frm.TopLevel = False
frm.WindowState = FormWindowState .Maximized
frm.Dock = DockStyle.Fill
frm.Anchor = AnchorStyles.Le ft + AnchorStyles.Ri ght + AnchorStyles.To p +
AnchorStyles.Bo ttom
frm.AutoSize = True
frm.AutoSizeMod e = Windows.Forms.A utoSizeMode.Gro wAndShrink
Me.pnlMain.Cont rols.Add(frm)
frm.Show()
What I want to do though is have the form resize when the panel control
(which resizes with it's main form) resizes....i've tried something like the
following but it's not working....How can I do this?
Private Sub pnlMain_Resize( ByVal sender As Object, ByVal e As
System.EventArg s) Handles pnlMain.Resize
On Error Resume Next
Debug.WriteLine (Me.pnlMain.Siz e.Width.ToStrin g & " x " &
Me.pnlMain.Size .Height.ToStrin g)
Debug.WriteLine (Me.pnlMain.Con trols.Item(0).W idth & " x " &
Me.pnlMain.Cont rols.Item(0).He ight)
Dim oFrm As New Form
If Me.pnlMain.Cont rols.Count 0 Then
'Debug.WriteLin e("There is a control in the panel " &
Me.pnlMain.Cont rols.Item(0).Na me)
With Me.pnlMain.Cont rols.Item(0)
.Size = New Size(Me.pnlMain .Size.Width,
Me.pnlMain.Size .Height)
End With
End If
End Sub
cotrol using.....
Me.pnlMain.Cont rols.Clear()
frm.TopLevel = False
frm.WindowState = FormWindowState .Maximized
frm.Dock = DockStyle.Fill
frm.Anchor = AnchorStyles.Le ft + AnchorStyles.Ri ght + AnchorStyles.To p +
AnchorStyles.Bo ttom
frm.AutoSize = True
frm.AutoSizeMod e = Windows.Forms.A utoSizeMode.Gro wAndShrink
Me.pnlMain.Cont rols.Add(frm)
frm.Show()
What I want to do though is have the form resize when the panel control
(which resizes with it's main form) resizes....i've tried something like the
following but it's not working....How can I do this?
Private Sub pnlMain_Resize( ByVal sender As Object, ByVal e As
System.EventArg s) Handles pnlMain.Resize
On Error Resume Next
Debug.WriteLine (Me.pnlMain.Siz e.Width.ToStrin g & " x " &
Me.pnlMain.Size .Height.ToStrin g)
Debug.WriteLine (Me.pnlMain.Con trols.Item(0).W idth & " x " &
Me.pnlMain.Cont rols.Item(0).He ight)
Dim oFrm As New Form
If Me.pnlMain.Cont rols.Count 0 Then
'Debug.WriteLin e("There is a control in the panel " &
Me.pnlMain.Cont rols.Item(0).Na me)
With Me.pnlMain.Cont rols.Item(0)
.Size = New Size(Me.pnlMain .Size.Width,
Me.pnlMain.Size .Height)
End With
End If
End Sub
Comment