继承一般形式不能在设计器中显示 [英] inheritance generic form cannot be shown in designer

查看:121
本文介绍了继承一般形式不能在设计器中显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我今天遇到一个问题。如下:

我创建一个通用表单,

public class Form1:Form

然后我创建另一个继承表单
public class From2:Form1。
无法在VS设计器中显示form2,错误消息是文件中的所有类都不能设计,(此错误消息从中文,中文信息是文件中的类都不能进行设计)。
但是这个程序可以编译成功,运行时,Form1和From2都可以工作。 />



任何人都可以给我一些帮助吗?



我不是以英语为母语的人,我希望我已经清楚地描述了我的问题。

解决方案

这是设计师的一个限制。您可以通过添加指定类型的临时派生表单来解决此问题。我在一篇博客文章中解释了这一点:

http://adamhouldsworth.blogspot.com/2010/02/winforms-visual-inheritance-limitations.html


I meet a problem today. As following.
I create a generic Form ,
public class Form1:Form
Then I create another inheritance form,
public class From2:Form1.
The form2 cannot be shown in the VS designer, the error message is "all the classes in the file cannot be designed", (this error message is translated from Chinese, the Chinese message is 文件中的类都不能进行设计).
But this program can be compiled successfully, and when it runs, both Form1 and From2 can work.

Anyone can give me some help about this ? Thanks.

I am not a native English speaker, I hope I have described my question clear.

解决方案

This is a limitation with the designer. You can work around it by adding an interim derived form that specifies the types. I've explained this in a blog post:

http://adamhouldsworth.blogspot.com/2010/02/winforms-visual-inheritance-limitations.html

这篇关于继承一般形式不能在设计器中显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆