C # Analog Marquee effect (2 kinds)

Source: Internet
Author: User

1   #regionMarquee Effect Method2         /// <summary>3         ///the text goes to the left and comes out from the right.4         /// </summary>5         Private voidLabelrun ()6         {7             if((lbmsg.location.x + lbmsg.width) >0)8             {9Lbmsg.left = Lbmsg.left-5;Ten             } One             Else//set Text initial position A             { -Lbmsg.left =Pbox.width; -             } the         } -  -         BOOLFlag =true;//Mark text Scroll line true--toward left false--to right -         /// <summary> +         ///text colliding back and forth inside the container -         /// </summary> +         Private voidLabelrunex () A         { at             if(flag) -             { -                 if(Lbmsg.left >0)//determines whether the text start collides to the left edge of the container -                 { -Lbmsg.left = Lbmsg.left-5; -                     if(Lbmsg.left <=0) in                     { -Flag =false; to                     } +                 } -             } the             Else *             { $Lbmsg.left = Lbmsg.left +5;Panax Notoginseng                 if(Lbmsg.left >= pbox.width-lbmsg.width)//determines whether the end of the text collides to the right edge of the container -                 { theFlag =true; +                 } A             } the         } +         #endregion
Method
1  #regionMarquee Thread2             NewThread (() =3             {4                  while(true)5                 {6                     Try7                     {8 Labelrunex ();9                     }Ten                     Catch { } OneThread.Sleep ( -); A                 } -             }) -{IsBackground =true }. Start (); the             #endregion
called

C # Analog Marquee effect (2 kinds)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.