Click here to Skip to main content
15,880,796 members
Articles / Desktop Programming / Windows Forms
Article

Multi-monitor Warp Speed Screen Saver

Rate me:
Please Sign up or sign in to vote.
4.60/5 (12 votes)
21 Dec 2008BSD1 min read 53.8K   1.6K   40   6
High-speed screen saver simulating a warp-speed effect; will span multiple monitors.
Image 1

Introduction

My son and I were watching a sci-fi show on television and saw a cool effect that simulated a spacecraft approaching light speed. Later he asked me if we could do something similar on the computer as a screen saver - this was our go at it.

Background

I found several C# starter programs that produced screen savers, but none of them I found would span multiple screens - this one does. It’s simple enough to be a good starting point for any other screen saver ideas you might have - if not, you can simply enjoy having this screen saver option in your collection.

Using the Code

To deploy the screen saver on your computer, you simply need to copy the binary file “Warp Speed.scr” to your Windows system32 folder (typically C:\Windows\system32\). Once there, the screen saver should appear on your system just like any other. There is a detailed set of options to tinker with for effect and the preview window works as well. Note that if you make modifications to the program and recompile, you will need to rename “Warp Speed.exe” to “Warp Speed.scr” and redeploy to your system folder. Here are some of the available options:

WarpSpeedOptions.JPG

Points of Interest

Of special interest to those wanting to write a screen saver that spans multiple monitors will be the ScreenArea class, here is an excerpt:

C#
/// <summary>
/// Gets the least "x" coordinate of all screens on the system
/// </summary>
/// <returns>The smallest visible "x" screen coordinate</returns>
public static int LeftMostBound
{
    get
    {
        int leftBound = int.MaxValue;

        // Return the left-most "x" screen coordinate
        foreach (Screen display in Screen.AllScreens)
        {
            if (leftBound > display.Bounds.X)
                leftBound = display.Bounds.X;
        }

        return leftBound;
    }
}

This class allows the screen saver to calculate the bounds across all attached screens as follows:

C#
// Screen saver is in full screen mode 
// (i.e., not the preview window) - make form span all available system screens
Left = ScreenArea.LeftMostBound;
Top = ScreenArea.TopMostBound;
Width = ScreenArea.TotalWidth;
Height = ScreenArea.TotalHeight;

History

  • 21st December, 2008: Initial post

License

This article, along with any associated source code and files, is licensed under The BSD License


Written By
Architect
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralMy vote of 5 Pin
Manoj Kumar Choubey15-Apr-12 23:07
professionalManoj Kumar Choubey15-Apr-12 23:07 
GeneralMy vote of 5 Pin
ARBebopKid24-Oct-11 5:02
ARBebopKid24-Oct-11 5:02 
GeneralYay Pin
mrwid14-Apr-11 22:04
mrwid14-Apr-11 22:04 
GeneralNice Pin
Are Jay23-Dec-08 8:46
Are Jay23-Dec-08 8:46 
GeneralNice :) Pin
Guillaume Leparmentier22-Dec-08 0:14
Guillaume Leparmentier22-Dec-08 0:14 
You will have a better rendering if you use :

m_graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
m_graphics.SmoothingMode = SmoothingMode.HighQuality;

when creating your Graphics instance (at the end of ScreenSaverForm_Load())



It's Still a fun sample, G.
GeneralRe: Nice :) Pin
James Ritchie Carroll22-Dec-08 11:56
James Ritchie Carroll22-Dec-08 11:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.