1/07/2014

C# Moving Label to the left and right

Moveing Label to the left and right
Moving Label to the left and right


 public partial class ScrollText : Form  
   {  
     public bool moveright = true; //This Variable should be declared globaly  
     public ScrollText()  
     {  
       InitializeComponent();  
     }  
     private void timer1_Tick(object sender, EventArgs e)  
     {  
       if (moveright == true)  
       {  
         lblScroll.Left += 5;  
       }  
       else  
       {  
         lblScroll.Left -= 5;  
       }  
       if (lblScroll.Left <= Convert.ToInt32(this.ClientRectangle.Left))  
       {  
         moveright = true;  
       }  
       if (lblScroll.Left + lblScroll.Width >= Convert.ToInt32(this.ClientRectangle.Right))  
       {  
         moveright = false;  
       }  
     }  
   }  

1 comment: