You are on page 1of 9

1

Screen Saver
1) What is a screen saver for a computer?
A screensaver is an animated image that is activated on a personal computer display when no user
activity has been sensed for a certain time.
2) Can we make screensaver in different applications of C#?
Yes, we can make screensaver in windows form application and as well as in console application. We
choose console application so you people can easily understand.

3) Do you really need a screen saver?


LCD monitors work differently than CRTs there are no phosphors to burn in. An LCD monitor will never
burn in in the same way as a CRT monitor. While many computers are still set to use an animated
screensaver after the computer has been idle for a period of time, this isn't really necessary.

4) What are the objectives of screensaver?


The original purpose of a screen saver was to prevent burn-in (the burning of an image into the phosphor
inside the cathode ray tube after hours of the same image being rescanned). In fact, todays CRT/LCD
display technology makes burn-in unlikely except under extreme conditions.
(On large displays used for room presentations, burn-in is still a possibility).

5) What are the main purpose of screensaver?

The working method of CRT (Cathode Ray Tube) monitors made it necessary to have an object always
moving on the screen. The CRT monitors used a gun that focused rays to different phosphorus pixel
centers on the back of CRT screens and used to hit them. The phosphorus points were heated upon hit
and produced light. Several hits all over the screen backside produced heat that converted into light to
show us images on the screen.
If an image was left still, the cathode ray gun would hit the same phosphorus points again and again to
retain the image. Since light was produced by heat, in those circumstances, the possibility of creating a
permanent burn was high and hence screensavers were introduced. Screensavers used to make the gun
hit different phosphor points as long as the screensavers were always moving.

2
One can argue why not simply turn OFF the monitor if not in use for a while. But the CRT monitors pulled
a heavy load of electricity when turned ON. This was a reason why turning off CRT monitors was not
recommended unless you were sure you wont be using the computers for more than an hour or so.

6) WHY SCREENSAVER IS NECESSARY?


Back then, they were necessary too, because of the CRT monitors. But as we moved towards LCD
monitors, are the screensavers are activated for security purposes mainly. The working method of CRT
(Cathode Ray Tube) monitors made it necessary to have an object always moving on the screen.

Advantages and Disadvantages of Screen Saver


*Advantages of screensavers:
Despite the above flaws, screensavers have remained popular, and for good reason: They can be very
entertaining.
From slideshows of paradisiacal photographs to story-telling animations, among the thousands of
available screensavers there is bound to be something for everyone.
A screensaver can add to the festivity and decorations during the holidays, or add life and color to
a room by projecting a virtual aquarium onto the screen.
Furthermore, screensavers can be password-protected, preventing anyone from accessing
your computer once the screensaver has started. Some screensavers even perform a useful
task, such as scanning your hard drive for viruses, or taking part in a distributed computing
project, while others may be educational or offer news headlines.
*Disadvantages

of screensavers:

If your main concern is either with the longevity of your display or the preservation of energy, the
single best way to "save your screen" is to power it off. There is no substitute for this: turning off
your display, whether manually or automatically after a specified period of time, saves power and
extends the lifetime of the device.
Moreover, when a screensaver is activated, a certain amount of processing power (CPU) and
memory (RAM) is used to project images onto your screen. The severity depends on the type of

3
screensaver: a complex, 3D-rendered and animated projection will use significantly more
resources than a simple slideshow of photos. This is becoming less of a concern, now that
modern computers are increasingly powerful and efficient in their use of energy.
Users of computers that get their power from a rechargeable battery, such as laptops, netbooks
and tablets, are generally advised to set strict power management rules and not to use
screensavers for long periods of time, unless the device is attached to an electrical socket by
means of a power cord. Otherwise, a screensaver may quickly drain the battery and cause a
shortage of power that may lead to a loss of unsaved work.

*Conclusion: it's up to you! :


While the initial purpose of a screensaver has somewhat lost its relevance in this day and age, it
is still a great way to personalize your computer, as you might with other desktop enhancements
such as wallpaper.
If you combine your screensaver with efficient power management settings, you get the best of
both worlds: you could use a screensaver for short periods of inactivity, and then allow your
computer to turn off the screen when you are away for longer periods of time. So, should you use
a screensaver? It's up to you!

Code
using System;
using System.Collections.Generic;
using System.Linq;

using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication114
{
class program
{
private int RandomNumber(int min, int max)
{
Random random = new Random();
int lastnum = random.Next(min, max);
if (lastnum % 3 == 0 || lastnum % 4 == 0 || lastnum % 5 == 0 ||
lastnum % 6 == 0 || lastnum % 7 == 0)
{
lastnum = random.Next(min, max);
}
return lastnum;
}
static void Main(string[] args)
{
int i = 1, lastcol, lastrow;
program obj = new program();
do
{

int j = obj.RandomNumber(1, 30);


Console.CursorLeft = j;
lastcol = j;
j = obj.RandomNumber(1, 50);
lastrow = j;
Console.CursorTop = j;
if (i % 3 == 0)
Console.ForegroundColor
else if (i % 4 == 0)
Console.ForegroundColor
else
Console.ForegroundColor
if ((i + j) % 2 == 0 || (i + j) %
Console.WriteLine(" ");
else
Console.WriteLine("* *

*
*

*
*

= ConsoleColor.White;
= ConsoleColor.Red;
= ConsoleColor.DarkBlue;
3 == 0 || (i + j) % 5 == 0)

");
for (int t = 0; t < 19999999; t++) ; i+
+;

5
}

while (i <= 10000);


Console.WriteLine("\n\n Finish");
Console.ReadLine();

Output of code

Explanation of code
Here we have 2 functions in 1 class. First main function will run than other.
Firstly, we start from Main function:

int i = 1, lastcol, lastrow;;

Here we just simply initialize i which is responsible for the colors of the stars and then we
initialize lastcol and lastrow which are integers.

program obj = new program();

We made object for random number j named as obj having class program as our class
name is program.

int j = obj.RandomNumber(1, 30);


/*Now we just initialize random number using object with method Random Number. It
moves to function where their call is placed.*/

public int RandomNumber(int min, int max)

Random Number is a method having int return type and public access specifier. It has
min and max integers in its parameters.

Random random = new Random();

Its a syntax used when we want to introduce random number.

int lastnum = random.Next(min, max);

Firstly lastnum initialized having int datatype and then new random number will be
introduced and store its value in the lastnum. random.Next(min,max) is syntax to generate
random number, here random is the object which we initialized above and then random number
will generate until random value is smaller than max.

if (lastnum % 3 == 0 || lastnum % 4 == 0 || lastnum % 5 == 0 || lastnum % 6 == 0 ||


lastnum % 7 == 0)
{
lastnum = random.Next(min, max);
}
When the value of lastnum is divisible by 3 or 4 or 5 or 6 or 7 then this value will be given

to that random number.

return lastnum;

This return lastnum to main function.

int j = obj.RandomNumber(1, 30);


Now it come back to there and run next line.

Console.CursorLeft = j;
/*Its a simple syntax to get or set the column position of j within buffer area(a
block of RAM that is used to hold input or output temporarily).*/
lastcol = j;
//we just equal lastcol to j.

If random is between 1 1o 29 then the position of star will be at left side and at last
column.

j = obj.RandomNumber(1, 49);
/*Now we just initialize random number using object with method Random Number. It
moves to function where their call is placed.*/
again second function will run as happens in above and come back to main function.

Console.CursorTop = j;
lastrow = j;

if the random number is between 1 to 49 then the position of the star will be at top and at
the last row.

if (i % 3 == 0)
Console.ForegroundColor = ConsoleColor.White;
/*this is the syntax of making forground colour to white means colour of star is white*/

if the value of i is divisible by 3 then the colour of the star will be white.
else if (i % 4 == 0) Console.ForegroundColor
= ConsoleColor.Red;

if the value of i is divisible by 4 then the colour of the star will be Red.

else

Console.ForegroundColor = ConsoleColor.DarkBlue;

if the value of i is not divisible by 4 or 3 then the colour of star will be dark blue.

if ((i + j) % 2 == 0 || (i + j) % 3 == 0 || (i + j) % 5 == 0)
Console.WriteLine(" ");

if the sum of i and j is divisible by 2 ,3 or 5 then there will be spaces introduce.

Else

*
");

Console.WriteLine("*
*
*
*

Otherwise a star will generate of different colors according to the given colors.

for (int t = 0; t < 19999999; t++) ; i+


+;

9
here we use a loop having condition that increment t at last t is smaller than 19999999.
here t is refer to above last if else, space or star will run t will generate spaces unless
t<1999999 and when condition will be wrong i will increase and move to while.

while (i <= 10000);


now here, if i is smaller and equal to 10000 than it will move to do and run all lines of do
than again i will increase and move to while, this procedure will run unless condition of while
will be wrong. When it will be wrong program running stop.
Console.WriteLine("\n\n Finish");
Console.ReadLine();

}
It will help us to get output on the black screen.

You might also like