[VB.NET]Merge MDI ToolStrip
ReadOnly Property MainToolStrip() As ToolStrip
End Interface 子視窗實做IChildForm介面,把子視窗的工具列開出。 Public Class Form1 Implements IChildForm
Public ReadOnly Property MainToolStrip() As System.Windows.Forms.ToolStrip Implements IChildForm.MainToolStrip
Get
Return ToolStrip1
End Get
End Property
End Class 在父視窗中處理MDIChildActivate事件,將工具列合併。 Public Class MDIParent1 Protected Overrides Sub OnMdiChildActivate(ByVal e As System.EventArgs) MyBase.OnMdiChildActivate(e) ToolStripManager.RevertMerge(ToolStrip) Dim childForm As IChildForm = CType(ActiveMdiChild, IChildForm) If childForm IsNot Nothing Then ToolStripManager.Merge(childForm.MainToolStrip, ToolStrip) End If End Sub End Class DownloadMergeMDIToolStrip.zip