Advanced .NET Framework (GDI+): Creating a Screen Saver with GDI+
This sample shows some how to create a screen saver using Visual Basic.NET.
Feature Highlights:
This how-to demonstrates many of the important features of creating screen
savers that can be automated by Windows. Concepts demonstrated are:
-
Creating a screen saver to fill the screen with a single form, and draw images
to the form.
-
Setting up an Options file, to store user defined options that guide how the
screen saver runs.
-
React to mouse and keyboard events to close the screen saver.
The screen saver preview functionality is not demonstrated, since it involves
several advanced threading issues.
Requirements:
Microsoft Visual Studio .NET Professional (or greater).
Windows 2000 or Windows XP.Running the Sample:
To run the sample:
-
Doubleclick the How-To Creating a Screensaver using GDI+.sln
file.
-
Click the "Install" button on the main form to copy the screen saver to the
Windows system folder.
-
Go into your display settings, and set the screen saver as How-To Screen
Saver.
-
Test the screensaver.
-
Explore the How-To Screen Saver Project project for an example
of creating your own screen saver.
Notes:
When you compile your own screen saver, there are several things to keep in
mind. First, be sure to set the following Form Properties:
-
FormBorderStyle = None
-
WindowState = Maximized
-
MaximizeBox = False
-
MinimizeBox = False
-
ShowInTaskbar = False
Also, before you can use a newly compiled screen saver, you must change its
extension from .EXE to .SCR, and copy it to the Windows system directory (by
default, in WinXP this is "C:\Windows\System32").
See Also:
System.Drawing,
System.Drawing.Graphics