将Designer.cs重新连接到mainform.cs

时间:2014-01-17 17:20:41

标签: c# visual-studio-2010

因此,当我抓住一些不同解决方案的文件并将它们粘贴到另一个解决方案中时,我的Mainform和设计师就会脱离其中。如果我运行我的程序,表单显示正确,但当我在设计模式下查看我的表单时,它是一个空白表单。有谁知道如何重新连接设计师?

感谢您的帮助。

1 个答案:

答案 0 :(得分:4)

使用文本编辑器编辑.csproj文件(记事本很好)以添加缺少的<DependentUpon>元素。所以它看起来像这样:

<Compile Include="Yadayada.cs">
  <SubType>Form</SubType>
</Compile>
<Compile Include="Yadayada.Designer.cs">
  <DependentUpon>Yadayada.cs</DependentUpon>
</Compile>