创建父窗体form1:
注意: 1).IsMIdContainer属性改为true(默认为false)--获取或设置一个值,该值指示窗体是否为多文档界面 (MDI) 子窗体的容器
创建子窗体formchid1,formchid2,formchid3,formchid4,在父窗体form1中创建4个按钮button1,button2,button3,button4 分别打开上面4个子窗体
3.父窗体部分代码:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
formchid1.MdiParent = Me
'formchid1.TopLevel = False
'formchid1.Parent = Me
formchid1.Dock = DockStyle.Fill
formchid1.Show()
formchid1.BringToFront()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
formchid2.MdiParent = Me
'formchid2.TopLevel = False
'formchid2.Parent = Me
formchid2.Dock = DockStyle.Fill
formchid2.Show()
formchid2.BringToFront()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
formchid3.MdiParent = Me
'formchid3.TopLevel = False
'formchid3.Parent = Me
formchid3.Dock = DockStyle.Fill
formchid3.Show()
formchid3.BringToFront()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
formchid4.MdiParent = Me
'formchid4.TopLevel = False
'formchid4.Parent = Me
formchid4.Dock = DockStyle.Fill
formchid4.Show()
formchid4.BringToFront()
End Sub
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。