[英]Usercontrols that inherit from abstract class
I've got a usercontrol that inherits from an abstract class.我有一个继承自抽象 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:但是,如果我尝试在设计器中打开
SimpleSlideView
控件本身,则会收到以下错误:
The designer must create an instance of type 'Animation.View' but it cannot because the type is declared as abstract.
设计者必须创建一个“Animation.View”类型的实例,但它不能,因为该类型被声明为抽象。
What have I missed?我错过了什么?
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?您可以在此处找到可能的解决方案: 如何获得 Visual Studio 2008 Windows Forms 设计器来呈现实现抽象基础 class 的表单?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.