从UserControl中继承下来一个用户控件,但是在vs2005的ide中,别的控件拖不进这个控件中,只能通过程序动态将别的控件添加到这个控件中。如何让其在ide中也能象其它容器控件,比如panel一样,可以将别的控件拖进去呢?方法如下:
在工程中引用System.Design.dll
[Designer("System.Windows.Forms.Design.ParentControlDesigner, System.Design")]
public partial class UserControl1 : UserControl
{
public UserControl1()
{
InitializeComponent();
}
}
本文介绍如何在Visual Studio 2005中使自定义UserControl支持拖拽其他控件的功能,通过引用System.Design.dll并使用特定属性标记自定义控件类,使其在IDE中具备类似Panel控件的特性。
753

被折叠的 条评论
为什么被折叠?



