我有一个类被声明为:复杂类声明混淆表单设计器?
public class Foo<T> : Panel where T : Control, IFooNode , new()
{
...
}
我说这手工测试,但我最终将需要的东西,可以显示在窗体设计器。窗体设计器不喜欢这一点,它说:
Could not find type 'FooTestNameSpace.Foo'. Please make sure that the assembly that contains this type is referenced. If this type is a part of your development project, make sure that the project has been successfully built.
有趣的是,我也得到一个警告类似,但包括我在变量的声明中使用的通用类型。 警告是:
Could not find type 'FooTestNameSpace.Foo<FooTestNameSpace.FooNodeType>'. Please make sure that the assembly that contains this type is referenced. If this type is a part of your development project, make sure that the project has been successfully built.
在我简单的Form1类的声明是:
private FooTestNameSpace.Foo myFoo;
(FooNodeType实际上只是一个还没有被使用一个辅助属性标签的子类,但它确实实现IFooNode )。
所以我的问题......有了这种类型的设置,我怎样才能让Foo在窗体设计器上显示,或者至少让它承认Foo是合法的?有没有可以处理这个问题的Designer属性?我真的不在乎Foo控件是否显示为空框,只要它完全显示!
设计人员很适合简单的拖放操作。对于更复杂的班级签名,您可能会期待太多。 – 2009-10-20 03:00:27
如果您还准确地解释了您想要使用该视图类来完成的任务,并且可能会显示更多代码,那可能会更有帮助。您完全有可能错过了使用声明,但无法从您的摘录中看出来。 – 2009-10-20 03:14:55