I am writing a screensaver in WPF. My screensaver works, but it only appears on my main monitor. Is there a way to cross out or draw graphics for additional monitors when the user has multiple displays? I did a little work, but did not find anything.
UPDATE
From the ananthonline answer below, I was able to perform a black effect on non-primary displays using the following window:
<Window x:Class="ScreenSaver.BlackOut" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Cursor="None" WindowStyle="None" ResizeMode="NoResize" Background="Black"> </Window>
and initialize one for each screen in App.xaml.cs using the following process:
foreach (Screen s in Screen.AllScreens) { if (s != Screen.PrimaryScreen) { BlackOut blackOut = new BlackOut(); blackOut.Top = s.WorkingArea.Top; blackOut.Left = s.WorkingArea.Left; blackOut.Width = s.WorkingArea.Width; blackOut.Height = s.WorkingArea.Height; blackOut.Show(); } }
Note that access to the Screen class requires importing into System.Windows.Forms .
c # wpf screensaver
Nathan friend
source share