W
W
I am trying to add active MDI forms to the window menu of the parent
window according to the link below
http://support.microsoft.com/kb/555284
The Window menu title is multi lingual (which is probably
insignificant).
My menu strip is named MenuStrip1 and
The window menu title is "ÔÈÇßWindowToolStripMenuItem"
It seems that the menu item is successfully added, but i am not able
to see it (probably because i am should not be using the click event).
I need help. Thanks
Public Class Main_Menu ' This is my parent window
Public Class MdiChildInfo
Private myForm As Form
Private Sub New()
End Sub
Public Sub New(ByVal pForm As Form)
Me.myForm = pForm
End Sub
Public Sub Click(ByVal sender As Object, ByVal e As EventArgs)
If (Not Me.myForm Is Nothing) Then
Me.myForm.Activate()
If ((Not Me.myForm.ActiveControl Is Nothing) AndAlso
Not Me.myForm.ActiveControl.Focused) Then
Me.myForm.ActiveControl.Focus()
End If
End If
End Sub
End Class
Private Sub ÔÈÇßWindowToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ÔÈÇßWindowToolStripMenuItem.Click
If Me.MdiChildren.Length > 0 Then
MenuStrip1.ContextMenu = New ContextMenu()
For Each tform As Form In Me.MdiChildren
Dim menuItem As New MenuItem(tform.Text, New
EventHandler(AddressOf New MdiChildInfo(tform).Click))
'Me.MainMenuStrip.ContextMenu.MenuItems.Add(menuItem)
MenuStrip1.ContextMenu.MenuItems.Add(menuItem)
menuItem.Checked = (tform Is MyBase.ActiveMdiChild)
Next
End If
MsgBox(MenuStrip1.ContextMenu.MenuItems.Count)
MenuStrip1.Focus()
End Sub
....
....
End Class
window according to the link below
http://support.microsoft.com/kb/555284
The Window menu title is multi lingual (which is probably
insignificant).
My menu strip is named MenuStrip1 and
The window menu title is "ÔÈÇßWindowToolStripMenuItem"
It seems that the menu item is successfully added, but i am not able
to see it (probably because i am should not be using the click event).
I need help. Thanks
Public Class Main_Menu ' This is my parent window
Public Class MdiChildInfo
Private myForm As Form
Private Sub New()
End Sub
Public Sub New(ByVal pForm As Form)
Me.myForm = pForm
End Sub
Public Sub Click(ByVal sender As Object, ByVal e As EventArgs)
If (Not Me.myForm Is Nothing) Then
Me.myForm.Activate()
If ((Not Me.myForm.ActiveControl Is Nothing) AndAlso
Not Me.myForm.ActiveControl.Focused) Then
Me.myForm.ActiveControl.Focus()
End If
End If
End Sub
End Class
Private Sub ÔÈÇßWindowToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ÔÈÇßWindowToolStripMenuItem.Click
If Me.MdiChildren.Length > 0 Then
MenuStrip1.ContextMenu = New ContextMenu()
For Each tform As Form In Me.MdiChildren
Dim menuItem As New MenuItem(tform.Text, New
EventHandler(AddressOf New MdiChildInfo(tform).Click))
'Me.MainMenuStrip.ContextMenu.MenuItems.Add(menuItem)
MenuStrip1.ContextMenu.MenuItems.Add(menuItem)
menuItem.Checked = (tform Is MyBase.ActiveMdiChild)
Next
End If
MsgBox(MenuStrip1.ContextMenu.MenuItems.Count)
MenuStrip1.Focus()
End Sub
....
....
End Class