article

Create an animated ScreenSaver in VB.NET with only 8 lines of code!!!

Email
Submitted on: 1/1/2015 8:39:00 PM
By: Javier García Alonso (from psc cd)  
Level: Beginner
User Rating: By 9 Users
Compatibility: VB.NET
Views: 9482
 
     With Visual Studio .NET you can introduce an animated .gif into a Picture Box Control without any code or external activeX control. This allows you to implement impressive screensaver easily.

This article has accompanying files
 
				Follow this steps:

1) Create new Proyect

-Creates a new Windows Aplication Proyect
-Create a Picture Box in your form


2) With Picture Box:

-Click in Image property and select an image or an animated GIF
-Set Dock property to Fill
-Set SizeMode property to StretchImage


3) With Form:

-Set WindowState property to Maximized
-Set FormBorderStyle property to None
-Set TopMost property to True


4) Now paste this code:

Private xposition As Integer Private yposition As Integer Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress Me.Close() End End Sub Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove If Not PictureBox1.MousePosition.X.Equals(xposition) Or _ Not PictureBox1.MousePosition.Y.Equals(yposition) Then Me.Close() End End If End Sub Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load xposition = PictureBox1.MousePosition.X yposition = PictureBox1.MousePosition.Y End Sub


5) Generate the proyect


6) How to test your ScreenSaver

-Go to bin folder of your proyect and change executable extension to .scr
E.j. MyScreensaver.exe ----> MyScreensaver.scr
-Copy this file into your system directory
Windows 98: c:\windows\system
Windows NT/2000/XP: c:\winnt\system32
-Now go to Windows Screen Properties (Right mouse button over Desktop) and select your screensaver.
-Test it. It Runs!!!

This is a zipped example:

winzip iconDownload article

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com


Other 3 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this article (in the Beginner category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

10/21/2016 4:14:13 PMJay

It should be noted that if you compile a 64bit version to put it in the syswow64 dir.
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular article, please click here instead.)
 

To post feedback, first please login.