---MDI窗体和多窗体编程--- 目的:在MDI窗体内用ToolBar实现多窗体的实例,在VB.NET中显示窗体一般代码如下
Private
Sub ToolBar1_ButtonClick()
Sub ToolBar1_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar1.ButtonClick
Select Case e.Button.Text
Case "OK" '"OK" is ToolBarButton.Text
Dim fr As New frmName
fr.MdiParent = Me 'Me is MdiForm
fr.Show()
End Select
End Sub
http://www.chinaaspx.com/club/topic_5_7796.htm
参考了一下,得出下面的代码
Private
Shared
fr
As
New
frmName
![](https://i-blog.csdnimg.cn/blog_migrate/77746c7a5d0a1d59a0ee8d83ee3d2192.gif)
Private
Sub ToolBar1_ButtonClick()
Sub ToolBar1_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar1.ButtonClick
Select Case e.Button.Text
Case "OK" '"OK" is ToolBarButton.Text
If fr Is Nothing Or fr.IsDisposed Then
fr = New frmName
fr.MdiParent = Me
fr.Show()
Else
fr.MdiParent = Me
fr.Show()
fr.Focus()
End If
End Select
End Sub
这样就实例了一次窗体~ ---end---
![](https://i-blog.csdnimg.cn/blog_migrate/77746c7a5d0a1d59a0ee8d83ee3d2192.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/094a500204517086b745d962e09daefc.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/39d18c83e08f2ca78894ba261a9746b1.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/39d18c83e08f2ca78894ba261a9746b1.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/39d18c83e08f2ca78894ba261a9746b1.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/39d18c83e08f2ca78894ba261a9746b1.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/39d18c83e08f2ca78894ba261a9746b1.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/39d18c83e08f2ca78894ba261a9746b1.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/a0a41553e16422be49dcbf1c1c1f313a.gif)
http://www.chinaaspx.com/club/topic_5_7796.htm
参考了一下,得出下面的代码
![](https://i-blog.csdnimg.cn/blog_migrate/f3426505992f4a2bfddec0d23f77316f.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/77746c7a5d0a1d59a0ee8d83ee3d2192.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/094a500204517086b745d962e09daefc.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/39d18c83e08f2ca78894ba261a9746b1.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/39d18c83e08f2ca78894ba261a9746b1.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/39d18c83e08f2ca78894ba261a9746b1.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/39d18c83e08f2ca78894ba261a9746b1.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/39d18c83e08f2ca78894ba261a9746b1.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/39d18c83e08f2ca78894ba261a9746b1.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/39d18c83e08f2ca78894ba261a9746b1.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/39d18c83e08f2ca78894ba261a9746b1.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/39d18c83e08f2ca78894ba261a9746b1.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/39d18c83e08f2ca78894ba261a9746b1.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/39d18c83e08f2ca78894ba261a9746b1.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/39d18c83e08f2ca78894ba261a9746b1.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/a0a41553e16422be49dcbf1c1c1f313a.gif)