private void PlayScreenSaver() { //Get the working area of the the computer screen. System.Drawing.Rectangle ssWorkArea = System.WinForms.Screen.GetWorkingArea(this);
//Make the label visible if it is not currently visible. lblMarquee.Visible=true;
// Increment the label distance based on the speed set by the user. iDistance += iSpeed; // If the label is offscreen, then we want to reposition it to the right. if (lblMarquee.Location.X <= -(lblMarquee.Width)) { //Reset the distance to 0. iDistance = 0;
//If the label is at the top, move it to the middle. if (lblMarquee.Location.Y == 0) lblMarquee.Location=new System.Drawing.Point(lblMarquee.Location.X, (ssWorkArea.Height / 2));
// If label is in the middle of the screen move it to the bottom. else if(lblMarquee.Location.Y== ssWorkArea.Height /2) lblMarquee.Location=new System.Drawing.Point(lblMarquee.Location.X,ssWorkArea.Height - lblMarquee.Height); //Move the label back to the top. else lblMarquee.Location=new System.Drawing.Point(lblMarquee.Location.X,0); } }