Where does the OwnerDrawMenuItem get the value for its .Text property?
In the sample application, the main form code-behind handles DockManager.WindowCreated. When a ToolWindow is created, an item is added to the View menu. This is standard-issue behavior for a tabbed mdi.
However, when the menu item is created...
'Add the View menu item for the tool window Dim menuItem As New OwnerDrawMenuItem(toolWindow.Text, New EventHandler(AddressOf Me.viewToolWindowMenuItem_Click)) menuItem.Tag = toolWindow viewMenuItem.MenuItems.Add(menuItem)
...the value for toolWindow.Text is an empty String. Yet at runtime, the menu item does contain the value of the tool window's .Text Property - which is actually set after the above event handler is entered.
I assume that a protected event on the OwnerDrawMenuItem is querying the .Tag property for a ToolWindow and getting its .Text from there.
However, I'm using Microsoft's menu objects. On DockManager.WindowCreated, I'm creating a new System.Windows.Forms.ToolStripMenuItem...
'Add the View menu item for the tool window Dim item As New ToolStripMenuItem(window.Text, Nothing, New EventHandler(AddressOf ViewToolWindowMenuItem_Click)) item.Tag = window ViewToolStripMenuItem.DropDownItems.Add(item)
At runtime, the DropDownItem appears to have an empty string for its .Text property.
Thanks for any help.
[Modified 8 years ago]