日期:2014-05-18 浏览次数:21147 次
//定义一个Hostt private ToolStripControlHost _controlHost; private void CreateHost(Control control) { if (control == null) { throw new ArgumentException("control"); } _popupControl = control; //将控件加入Host,通常是用户控件,也可以手动加入其它控件 _controlHost = new ToolStripControlHost(control, "popupControlHost"); _controlHost.AutoSize = false; _controlHost.Padding = Padding.Empty; _controlHost.Margin = Padding.Empty; base.Size = new Size( control.Size.Width + Padding.Horizontal, control.Size.Height + Padding.Vertical); //将该Host加入本类容器中。 base.Items.Add(_controlHost); }
------解决方案--------------------