屏保如何支持多个显示器?

时间:2023-02-05 11:31:36

If i were developing a screensaver using a windows.form in C# how would i support multiple monitors? obviously i need a way to enumerate the monitors and maybe create forms for them too or just fade to black? Has anyone solved this?

如果我在C#中使用windows.form开发屏幕保护程序,我将如何支持多个显示器?显然我需要一种方法来枚举监视器,也可能为它们创建表单或者只是淡化为黑色?有人解决过这个吗?

Any insight would be helpful, what's the best approach?

任何见解都会有所帮助,最好的方法是什么?

1 个解决方案

#1


3  

I would recommend this article from CodeProject it helped me create my first screen saver and talks about multiple monitor support.

我会从CodeProject推荐这篇文章,它帮助我创建了我的第一个屏幕保护程序并讨论了多个监视器支持。

System.Windows.Forms.Screen class has all the information you need about how many monitors and what the bounds of those monitors are. The property AllScreens would be a good place to start.

System.Windows.Forms.Screen类包含有关监视器数量以及这些监视器边界的所有信息。 AllScreens酒店将是一个很好的起点。

for (int i = Screen.AllScreens.GetLowerBound(0); i <= Screen.AllScreens.GetUpperBound(0); i++)
{
ScreensaverFormList[i].Bounds = Screen.AllScreens[i].Bounds;
}

for(int i = Screen.AllScreens.GetLowerBound(0); i <= Screen.AllScreens.GetUpperBound(0); i ++){ScreensaverFormList [i] .Bounds = Screen.AllScreens [i] .Bounds; }

#1


3  

I would recommend this article from CodeProject it helped me create my first screen saver and talks about multiple monitor support.

我会从CodeProject推荐这篇文章,它帮助我创建了我的第一个屏幕保护程序并讨论了多个监视器支持。

System.Windows.Forms.Screen class has all the information you need about how many monitors and what the bounds of those monitors are. The property AllScreens would be a good place to start.

System.Windows.Forms.Screen类包含有关监视器数量以及这些监视器边界的所有信息。 AllScreens酒店将是一个很好的起点。

for (int i = Screen.AllScreens.GetLowerBound(0); i <= Screen.AllScreens.GetUpperBound(0); i++)
{
ScreensaverFormList[i].Bounds = Screen.AllScreens[i].Bounds;
}

for(int i = Screen.AllScreens.GetLowerBound(0); i <= Screen.AllScreens.GetUpperBound(0); i ++){ScreensaverFormList [i] .Bounds = Screen.AllScreens [i] .Bounds; }