110,537
社区成员
发帖
与我相关
我的任务
分享
internal class AxDropDown<T> : ToolStripDropDown where T : Control, new()
{
private T _ctrl = null;
protected ToolStripControlHost _host = null;
public AxDropDown()
{
_ctrl = new T();
_ctrl.Width = 200;
_ctrl.Height = 200;
_host = new ToolStripControlHost(_ctrl);
_host.AutoSize = false;
_ctrl.SizeChanged += new EventHandler(_ctrl_SizeChanged);
this.Items.Add(_host);
}
public T DropControl
{
get { return _ctrl; }
}
private void _ctrl_SizeChanged(object sender, EventArgs e)
{
_host.Size = _ctrl.Size;
}
}