且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我可以承载Windows窗体控件内

更新时间:2023-12-06 08:34:28

您可以通过它的顶层属性设置为False把一个Form类回子控件。它成为基本上与一些未使用的开销一个用户控件。使它看起来类似于这样:

You can turn a Form class back to a child control by setting its TopLevel property to False. It becomes essentially a UserControl with some unused overhead. Make it look similar to this:

Public Class Form1
    Public Sub New()
        InitializeComponent()
        Dim frm As New Form2
        frm.TopLevel = False
        frm.FormBorderStyle = Windows.Forms.FormBorderStyle.None
        frm.Visible = True
        frm.Dock = DockStyle.Fill
        TabPage1.Controls.Add(frm)
    End Sub
End Class