Results 1 to 3 of 3
  1. #1
    dcrew10's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    Manchester, England
    Posts
    448
    Reputation
    10
    Thanks
    285
    My Mood
    Happy

    Scrolling Label Function

    Hello, just thought I'd release a scrolling label text function that I made.

    Code:
            void scrollText(ref Label lbl, string lblText, int maxCharDisplay)
            {
                string lblTextTotal = lblText + lblText;
                if (maxCharDisplay > (lblText.Length - 1)) maxCharDisplay = (lblText.Length - 1);
                if (lbl.Tag == null) lbl.Tag = 0;
                int curIndex = Convert.ToInt32(lbl.Tag.ToString());
                lbl.Text = lblTextTotal.Substring(curIndex, maxCharDisplay);
                curIndex++;
                if (curIndex > (lblText.Length - 1)) curIndex = 0;
                lbl.Tag = curIndex;
            }
    If you want a label in your form to scroll some text..

    Code:
    scrollText(ref Label1, "BETA--", 10);
    put that inside of a timer, or whenever you want it to scroll just use that code above.
    C# (XNA) Coder


  2. The Following User Says Thank You to dcrew10 For This Useful Post:

    sakinoakura (10-03-2012)

  3. #2
    sakinoakura's Avatar
    Join Date
    Aug 2012
    Gender
    male
    Posts
    16
    Reputation
    10
    Thanks
    2
    My Mood
    Cheerful
    Thanks for the function.

  4. #3
    tjackiseN's Avatar
    Join Date
    Oct 2012
    Gender
    male
    Location
    GTAIV.exe
    Posts
    174
    Reputation
    10
    Thanks
    751
    My Mood
    Tired
    Scrolling text (for Console App)

    Code:
            private static void ScrollPrint(string text, int speed)
            {
                foreach (char c in text)
                {
                    Console.Write(c);
                    Thread.Sleep(speed);
                }
            }
    Example:

    Code:
    ScrollPrint("Test", 100);

Similar Threads

  1. scroll thing...
    By ZeaS in forum Visual Basic Programming
    Replies: 5
    Last Post: 09-09-2007, 10:35 AM
  2. Replies: 8
    Last Post: 07-09-2007, 03:15 PM
  3. Hl to label
    By smartie in forum Visual Basic Programming
    Replies: 5
    Last Post: 07-03-2007, 11:00 AM
  4. Disable some of punkbuster's functions.
    By System79 in forum Game Hacking Tutorials
    Replies: 3
    Last Post: 09-06-2006, 11:32 PM
  5. Elder Scrolls oblivion!
    By jadedfrog in forum General Gaming
    Replies: 23
    Last Post: 07-03-2006, 08:32 PM