窗体包含窗体--MDI多文档界面

  1. 创建父窗体form1:

    创新互联长期为上1000+客户提供的网站建设服务,团队从业经验10年,关注不同地域、不同群体,并针对不同对象提供差异化的产品和服务;打造开放共赢平台,与合作伙伴共同营造健康的互联网生态环境。为筠连企业提供专业的成都网站设计、做网站,筠连网站改版等技术服务。拥有十年丰富建站经验和众多成功案例,为您定制开发。

    注意: 1).IsMIdContainer属性改为true(默认为false)--获取或设置一个值,该值指示窗体是否为多文档界面 (MDI) 子窗体的容器

  2. 创建子窗体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



本文名称:窗体包含窗体--MDI多文档界面
文章地址:http://myzitong.com/article/ihiggs.html