
What is it?
A screensaver that displays the .NET logo at random positions with an interval
of 10 seconds - an exact copy (including the config message box) of the
Windows� 2000 Logon screensaver, except that of the image used (of
course!). A good way to display 'loyalty' to the .NET framwework :-).
The code could be easily modified to create a screensaver of your own.
Conclusion
Code straightaway! Happy programming...
| You must Sign In to use this message board. |
|
| | Msgs 1 to 9 of 9 (Total in Forum: 9) (Refresh) | FirstPrevNext |
|
 |
|
|
 |
|
|
 |
|
 |
This code seems to handle multiple monitor displays (the original just blanked the primary display.) I've not tested it with different resolutions on my two monitor's though - there might be another posting soon 
private void ScreenSaverForm_Load(object sender, System.EventArgs e) {
Rectangle rectBounds = new Rectangle(0, 0, 0, 0);
for(int x = 0; x <= Screen.AllScreens.GetUpperBound(0); x++) { rectBounds.Width += Screen.AllScreens[x].Bounds.Width; }
rectBounds.Height = Screen.AllScreens[0].Bounds.Height;
this.Bounds = rectBounds;
VisibleRect = new Rectangle(0, 0, Bounds.Width-pictureBox.Width, Bounds.Height-pictureBox.Height); Cursor.Hide(); TopMost = true;
}
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
 |
|
 |
That code does only work correctly if a) the leftmost monitor is the primary one, b) the monitors are sitting next to each other (not *above* each other) AND c) the leftmost/primary monitor has the highest Y:-solution.
This code is an improvement of the fix above and fixes the problem:
private void ScreenSaverForm_Load(object sender, System.EventArgs e) { int xmin=0; int xmax=0; int ymin=0; int ymax=0;
for(int x = 0; x <= Screen.AllScreens.GetUpperBound(0); x++) { if(Screen.AllScreens[x].Bounds.Left<xmin) xmin=Screen.AllScreens[x].Bounds.Left; if(Screen.AllScreens[x].Bounds.Top<ymin) ymin=Screen.AllScreens[x].Bounds.Top; if(Screen.AllScreens[x].Bounds.Left>xmax) xmax=Screen.AllScreens[x].Bounds.Right; if(Screen.AllScreens[x].Bounds.Top>ymax) ymax=Screen.AllScreens[x].Bounds.Bottom; } Rectangle rectBounds = new Rectangle(xmin, ymin, xmax-xmin, ymax-ymin); this.Bounds = rectBounds; VisibleRect = new Rectangle(0, 0, Bounds.Width-pictureBox.Width, Bounds.Height-pictureBox.Height); Cursor.Hide(); TopMost = true; }
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |
|
 |
A minor fix is needed in the code so that xmax and ymax are set correctly...
private void ScreenSaverForm_Load(object sender, System.EventArgs e) { int xmin=0; int xmax=0; int ymin=0; int ymax=0;
for(int x = 0; x <= Screen.AllScreens.GetUpperBound(0); x++) { if(Screen.AllScreens[x].Bounds.Left<xmin) xmin=Screen.AllScreens[x].Bounds.Left; if(Screen.AllScreens[x].Bounds.Top<ymin) ymin=Screen.AllScreens[x].Bounds.Top; if(Screen.AllScreens[x].Bounds.Right>xmax) xmax=Screen.AllScreens[x].Bounds.Right; if(Screen.AllScreens[x].Bounds.Bottom>ymax) ymax=Screen.AllScreens[x].Bounds.Bottom; } Rectangle rectBounds = new Rectangle(xmin, ymin, xmax-xmin, ymax-ymin); this.Bounds = rectBounds; VisibleRect = new Rectangle(0, 0, Bounds.Width-pictureBox.Width, Bounds.Height-pictureBox.Height); Cursor.Hide(); TopMost = true; }
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |
|
|
 |
|
 |
I like that ...but u see, that's my 'default' expression . Anyway, I will try to more smiliey in the next photo - thanks!
Happy programming, Rakesh Rajan
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
General
News
Question
Answer
Joke
Rant
Admin