[C#] winform窗体分布类实现

发布时间 2023-06-21 16:12:16作者: sssfffsssfff

 为Form1窗体添加一个partial属性的分布类,需要以下几步:

1. 使用Visual Studio创建你的新工程,包含窗体Form1
2. 创建一个新文件,命名成这样的格式:Form1.Behind.cs 3. 新class编辑为partial属性
5. 保存全部并关闭Visual Studio
6. 使用记事本打开[.csproj]文件
7. 寻找以下字段: [code] <Compile Include="Form1.Behind.cs"> <SubType>Form</SubType> </Compile> [/code] Change it to this: [code] <Compile Include="Form1.Behind.cs"> <DependentUpon>Form1.cs</DependentUpon> </Compile> [/code] 8. Save the file. 9. Open the project in Visual Studio 2005.

 

参考链接:https://social.msdn.microsoft.com/Forums/en-US/64c77755-b0c1-4447-8ac9-b5a63a681b78/partial-class-for-a-form-problem?forum=csharpide