继承自抽象类的用户控件
我有一个继承自抽象类的用户控件。基本上看起来是这样的。
class SimpleSlideView : View
{
}
public abstract class View : UserControl
{
}
该项目编译并运行良好。我可以将用户控件(从工具箱中)拖到窗体中,然后它会正确显示在设计器中。但是,如果我尝试在设计器中打开 SimpleSlideView
控件本身,我会收到以下错误:
设计者必须创建一个实例 类型为“Animation.View”,但不能 因为类型被声明为 摘要。
我错过了什么?
I've got a usercontrol that inherits from an abstract class. Basically looks like this.
class SimpleSlideView : View
{
}
public abstract class View : UserControl
{
}
The project compiles and runs fine. I can take the usercontrol (from the toolbox) and drag it into a form and it is displayed in the designer correctly. However, if I try and open the SimpleSlideView
control itself in the designer I receive the following error:
The designer must create an instance
of type 'Animation.View' but it cannot
because the type is declared as
abstract.
What have I missed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在这里找到可能的解决方案: 如何让 Visual Studio 2008 Windows 窗体设计器呈现实现抽象基类的窗体?
You can find possible solution here: How can I get Visual Studio 2008 Windows Forms designer to render a Form that implements an abstract base class?