Hi Lance,
Based on my understand, you want to showing a customized control in the
ToolStripMenuItem DropDown property.
To get this done, you should not use ToolStripMenuItem.DropDown.Controls
property. The correct solution is using ToolStripControlHost to host your
customize control and add ToolStripControlHost to ToolStripDropDown.Items
collection. I created a little sample application demonstrating the usage:
private void Form1_Load(object sender, EventArgs e)
{
TreeView treeview = new TreeView();
TreeNode treeNode1=new TreeNode();
treeview.Name = "treeview";
treeNode1.Name = "Node1";
treeNode1.Text = "Node1";
treeview.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {treeNode1
});
treeview.BorderStyle = BorderStyle.None;
ToolStripControlHost treeViewHost = new ToolStripControlHost(treeview);
ToolStripDropDown dropDown = new ToolStripDropDown();
dropDown.Items.Add(treeViewHost);
this.toolStripMenuItem1.DropDown = dropDown;
}
Note: I created a TreeView control and hosted it in ToolStripControlHost,
finally, I added it into ToolStripDropDown.Items collection.
The articles below contains more information:
"Writing custom popup controls"
http://blogs.msdn.com/jfoscoding/archive/2005/09/18/471048.aspx
"Adding a custom control to a ToolStripDropDownButton"
http://www.codeproject.com/cs/menu/ToolStripDropDown.asp
Hope this helps.
Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.