The comments hint that it is not supported yet.
So I show you what we have done to implement it using Windows Forms (took me some time to understand how to reference Windows Forms in a .NET Core library project correctly):
You can add the Windows Forms dependency like so to the csproj file:
<ItemGroup>
<FrameworkReference Include="Microsoft.WindowsDesktop.App.WindowsForms" />
</ItemGroup>
Then you can use the Screen
class again:
new Size
{
Width = Screen.AllScreens.Sum(s => s.Bounds.Width),
Height = Screen.AllScreens.Max(s => s.Bounds.Height)
}
IMPORTANT: This works on Windows only, but at least it is .NET Core compatible.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…