Skip to main content
 首页 » 编程设计

c#之将 Designer.cs 重新附加到 mainform.cs

2024年02月13日12telwanggs

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

感谢您的帮助。

请您参考如下方法:

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

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