---MDI窗體和多窗體編程--- 目的:在MDI窗體內用ToolBar實現多窗體的實例,在VB.NET中顯示窗體一般代碼如下
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ -->
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ -->
Private
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
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
參考了一下,得出下面的代碼
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ -->
這樣就實例了一次窗體~ ---end---
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ -->
Private Shared fr As New frmName
Private 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
Private Shared fr As New frmName
Private 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
更多文章、技術交流、商務合作、聯系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號聯系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元
