【发布时间】:2013-04-18 16:37:15
【问题描述】:
我有一个 UserControl 类 Employee_EmployeeKeyOneRelationUC 继承自 RelationUC 继承自 RelationBase 继承自 System.Window.Forms.UserControl
当我尝试在 Designer 中打开我的 Employee_EmployeeKeyOneRelationUC 时,出现此错误:
The designer could not be shown for this file because none of the classes within it can be designed. The designer inspected the following classes in the file: Employee_EmployeeKeyOneRelationUC --- The base class 'AstusFMS.Content.RelationUC' could not be loaded. Ensure the assembly has been referenced and that all projects have been built.
但是当我打开 RelationUC 和 RelationBase 时,两者都正确显示。
我的程序仍在编译,但为什么这让我感到困扰?因为我有一个表单EmployeeForm,它使用了很多UserControl(如Employee_EmployeeKeyOneRelationUC),当我尝试编辑此表单中的某些内容时,表单中包含的每个继承自UserControleBase 的UserControl 都被删除(左: TFS 服务器,右:本地):
这个差异表明设计者删除了我所有的ucEmployee* 对象。只是因为我更改了 ComboBox 的名称(组合框与其中一个 UC 无关)。
我注意到,当我创建一个新的 UserControl 文件时,显示的默认代码有一个错误:
但是Using System.Windows.Forms; 就在那里。如果我将UserControl 更改为System.Windows.Forms.UserControl 它可以工作。
我可能不够清楚,所以如果你有问题,我会整天回答和测试。
使用 VS2010、VS2012 Update 1、VS2012 Update 2 在 3 台不同的计算机上测试
【问题讨论】:
-
您的解决方案中是否有名称空间,路径中有“UserControl”?当你完全限定它时它会起作用,因为它能够区分你想要的类和你不想要的命名空间。
-
是的,我没有考虑过。这是解决的一个问题。您对不会显示的 UC 和我的删除代码有什么想法吗?
标签: c# winforms visual-studio-2012 devexpress