简体   繁体   中英

Autosize WinForm in Panel VB.Net

How to make the form A size follow the panel size in the form B when i maximize or normal size form B, because form A is displayed in the form panel B in vb.net. sorry for my bad english, hope the masters can help me. This my code in form Main:

Private Sub TVMenu_KeyPress(sender As Object, e As KeyPressEventArgs) Handles TVMenu.KeyPress
    If e.KeyChar = Chr(13) Then
        Select Case TVMenu.SelectedNode.Name
            Case Is = "nGuru"
                FmGuru.Close()
                FmGuru.TopLevel = False
                FmGuru.FormBorderStyle = Windows.Forms.FormBorderStyle.None
                FmGuru.WindowState = FormWindowState.Maximized
                PContent.Controls.Add(FmGuru)
                FmGuru.Show()
        End Select
    End If
End Sub

I mean FmGuru show in panel FormMain, when i show FmGuru when FormMain size Normal FmGuru show Normal, but when I maximize FmMain, FmGuru not follow to maximize. thank before

ilustration:

Normal Form Size Condition

Max Form Size Condition

Private Sub TVMenu_KeyPress(sender As Object, e As KeyPressEventArgs) Handles TVMenu.KeyPress
    If e.KeyChar = Chr(13) Then
        Select Case TVMenu.SelectedNode.Name
            Case Is = "nGuru"
                FmGuru.Close()
                FmGuru.TopLevel = False
                FmGuru.WindowState = FormWindowState.Normal 
                pContent.Autoscroll = True
                FmGuru.Dock = Dockstyle.Fill
                FmGuru.FormBorderStyle = Windows.Forms.FormBorderStyle.None
                FmGuru.WindowState = FormWindowState.Maximized
                PContent.Controls.Add(FmGuru)
                FmGuru.Show()
        End Select
    End If
End Sub

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM