.NET继承(的WinForms)形式 - VS设计问题 [英] .NET inherited (WinForms) Form - VS designer issue

查看:143
本文介绍了.NET继承(的WinForms)形式 - VS设计问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个C#应用程序几种形式。我使用Visual Studio 2010 Beta版,但.NET 3.5和C#3。

I have several forms in a C# application. I use Visual Studio 2010 Beta, but .NET 3.5 and C# 3.

我有一个基本形式,在人的可持续发展空间称为FilteredQueryViewForm,我想一些其他形式的继承它(因为它们基本上都会做同样的东西,但也有一些添加物)。

I have a base form, called FilteredQueryViewForm in the Shd namespace and I want some other forms to inherit it (because they will basically do the same stuff, but with some additions).

我改变私人的事情在FilteredQueryViewForm类保护,所以他们从访问派生形式。在此之后我创建了一个派生形式,并设置基类FilteredQueryViewForm。

I changed things from private to protected in the FilteredQueryViewForm class, so they're accessible from the derived forms. After this I've created a derived form and set the base class to FilteredQueryViewForm.

派生类的设计者抱怨Shd.FilteredQueryViewForm没有任何构造函数...不管实际上它有一个与3个参数。我以为参数可以是一个问题,所以我还创建了一个(公共的,当然)构造函数没有参数,但它仍然无法正常工作。该错误信息是相同的:

The designer of the derived class complained about Shd.FilteredQueryViewForm not having any constructors... regardless of the fact it had one, with 3 parameters. I thought parameters can be a problem, so I also created a (public, of course) constructor without parameters, but it still doesn't work. The error message is the same:

。构造函数型Shd.FilteredQueryViewForm找不到

"Constructor on type 'Shd.FilteredQueryViewForm' not found."

和派生类的设计者将不会加载。
我都试过重新启动vs2010beta,重新创建衍生形式,但似乎没有什么帮助。谷歌没有取得任何有用的结果对我来说这个问题。 (

And the designer of the derived class won't load. I have tried restarting vs2010beta, re-creating the derived form, but nothing seem to help. Google didn't yield any useful results for me on this problem. :(

这是Visual Studio 2010的测试版的还是我做错了什么问题

Is this a problem of Visual Studio 2010 Beta? Or am I doing something wrong?

推荐答案

您将需要在没有参数的构造函数调用InitializeComponent()方法在每一个你的表格。
然后关闭设计窗口,重新生成解决方案,并尝试重新设计,这应工作。重建的解决方案是必不可少的。

You will need a constructor without parameters which calls the InitializeComponent() method in every of your forms. Then close the designer window, rebuild the solution and try to reopen the designer. That should work. Rebuilding the solution is essential.

现在的问题是,如果你创建一个从Shd.FilteredQueryViewForm能继承形式,设计师将尝试调用构造函数父窗体,但它加载这种形式不是从代码,但在它的内置组件。

The problem is, that if you create a form that inheritates from Shd.FilteredQueryViewForm, the designer will try to call the constructor of the parent form, but it loads this form not from code but from it's built assembly.

这篇关于.NET继承(的WinForms)形式 - VS设计问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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