WPF中添加System.Windows.Forms.dll

在项目文件中添加配置项 <UseWindowsForms>true</UseWindowsForms> 即可,位置如下:

1
2
3
4
5
6
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>