Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    Bombsaway707's Avatar
    Join Date
    Jun 2009
    Gender
    male
    Location
    Gym
    Posts
    8,799
    Reputation
    791
    Thanks
    4,004
    My Mood
    Amused

    [Help]How to make scrolling text?[solved]

    How would i make text that scrolls across the application like, the label starts at one side of the program, slowly moves over towards the other side then once its out of sight on the other side it moves back to where it originally was and slowly moves across the application again, how would i do this
    I looked all over google but i cant seem to find it

  2. #2
    ken53406's Avatar
    Join Date
    Oct 2008
    Gender
    male
    Location
    In your moms slop hole :D
    Posts
    151
    Reputation
    9
    Thanks
    97
    My Mood
    Aggressive
    Put label on form1, put timer on form1.
    timer 1 enabled, interval 100.
    go into timer1 code.

    put in:
    Code:
    Label1.Left -= 5
    If Label1.Left <= -Width Then
    Label1.Left = Width
    End If
    End Sub
    End Class
    Put that shit under Private Sub Timer1_Tick
    troll says: FUK YO COUCH NIGGA!
    V
    [img]https://www.******************/forums/images/smilies/troll_run.gif[/img]


    My goals list:
    Legend:

    Complete - Incomplete -

    30 Posts: [] | 50 Posts: []
    70 Posts: [] | 100 Posts: []
    500 Posts: [] | 1,000 Posts: []
    Release a CA NA pub: [] | Release a CFNA Pub: []
    Pro C++ Coder: [] | Pro VB Coder: []
    [IMG]https://images.encyclopediadramatic*****m/images/5/57/Pedobear_a.gif[/IMG]

    Don't forget:

  3. The Following User Says Thank You to ken53406 For This Useful Post:

    flameswor10 (12-30-2010)

  4. #3
    Lolland's Avatar
    Join Date
    Feb 2009
    Gender
    male
    Location
    Lolland!
    Posts
    3,156
    Reputation
    49
    Thanks
    868
    My Mood
    Inspired
    Code:
    Do Until Label1.location.X = 100 'or whatever
    Label1.Location = New Point(Label1.Location.X - 2, Label1.location.y)
    System.Threading.Thread.Sleep(100)
    Loop
    Last edited by Lolland; 12-30-2010 at 09:05 PM.

  5. The Following 2 Users Say Thank You to Lolland For This Useful Post:

    Bombsaway707 (01-07-2011),flameswor10 (12-30-2010)

  6. #4
    ken53406's Avatar
    Join Date
    Oct 2008
    Gender
    male
    Location
    In your moms slop hole :D
    Posts
    151
    Reputation
    9
    Thanks
    97
    My Mood
    Aggressive
    My way works exactly the same, its smoother and its a million times easier lol
    troll says: FUK YO COUCH NIGGA!
    V
    [img]https://www.******************/forums/images/smilies/troll_run.gif[/img]


    My goals list:
    Legend:

    Complete - Incomplete -

    30 Posts: [] | 50 Posts: []
    70 Posts: [] | 100 Posts: []
    500 Posts: [] | 1,000 Posts: []
    Release a CA NA pub: [] | Release a CFNA Pub: []
    Pro C++ Coder: [] | Pro VB Coder: []
    [IMG]https://images.encyclopediadramatic*****m/images/5/57/Pedobear_a.gif[/IMG]

    Don't forget:

  7. #5
    Lolland's Avatar
    Join Date
    Feb 2009
    Gender
    male
    Location
    Lolland!
    Posts
    3,156
    Reputation
    49
    Thanks
    868
    My Mood
    Inspired
    Mine should run smoother now.

  8. #6
    ken53406's Avatar
    Join Date
    Oct 2008
    Gender
    male
    Location
    In your moms slop hole :D
    Posts
    151
    Reputation
    9
    Thanks
    97
    My Mood
    Aggressive
    Erm mmkay idc just posting to help. Whichever he decides is best
    troll says: FUK YO COUCH NIGGA!
    V
    [img]https://www.******************/forums/images/smilies/troll_run.gif[/img]


    My goals list:
    Legend:

    Complete - Incomplete -

    30 Posts: [] | 50 Posts: []
    70 Posts: [] | 100 Posts: []
    500 Posts: [] | 1,000 Posts: []
    Release a CA NA pub: [] | Release a CFNA Pub: []
    Pro C++ Coder: [] | Pro VB Coder: []
    [IMG]https://images.encyclopediadramatic*****m/images/5/57/Pedobear_a.gif[/IMG]

    Don't forget:

  9. #7
    flameswor10's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Posts
    12,528
    Reputation
    981
    Thanks
    10,409
    My Mood
    In Love
    Nice coding. Both of you
    Don't fight about which code to use though D:
    No I do not make game hacks anymore, please stop asking.

  10. The Following User Says Thank You to flameswor10 For This Useful Post:

    ken53406 (12-30-2010)

  11. #8
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Quote Originally Posted by Lolland View Post
    Code:
    Do Until Label1.location.X = 100 'or whatever
    Label1.Location = New Point(Label1.Location.X - 2, Label1.location.y)
    System.Threading.Thread.Sleep(100)
    Loop
    Eugh, timer is a much better option unless you're running this in a different thread with proper delegates. System.Threading.Thread.Sleep sleeps the thread that the code was executed from, which in this case will be the UI thread. This means that during that sleep time, no other code on the UI thread will be executed. If you're trying to have scrolling text running asynchronously, either use a timer or another thread. The timer still runs on the UI thread, but won't lag the thread. Here's one with delegates and threading:

    [php]
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim scrollThread As New Threading.Thread(AddressOf Scrolling)
    scrollThread.Start()
    End Sub

    Private Delegate Sub MoveLabelInvoker(ByVal lbl As Label)

    Private Sub MoveLabel(ByVal lbl As Label)
    If lbl.InvokeRequired Then
    lbl.Invoke(New MoveLabelInvoker(AddressOf MoveLabel), lbl)
    Else
    If Not lbl.Left + lbl.Width <= 0 Then
    lbl.Left -= 1
    Else
    lbl.Left = Me.Width
    End If
    End If
    End Sub

    Private Sub Scrolling()
    Do
    MoveLabel(Me.Label1)
    System.Threading.Thread.Sleep(30)
    Loop
    End Sub
    [/php]

    Enjoy.
    Last edited by Jason; 12-31-2010 at 09:37 PM.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  12. The Following 2 Users Say Thank You to Jason For This Useful Post:

    Bombsaway707 (01-07-2011),ken53406 (01-04-2011)

  13. #9
    Lolland's Avatar
    Join Date
    Feb 2009
    Gender
    male
    Location
    Lolland!
    Posts
    3,156
    Reputation
    49
    Thanks
    868
    My Mood
    Inspired
    I assumed he would be using different threads.

  14. #10
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Quote Originally Posted by Lolland View Post
    I assumed he would be using different threads.
    Well then it's going to fail regardless 'cos you're accessing the control outside the thread it was created on = dead.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  15. The Following User Says Thank You to Jason For This Useful Post:

    ken53406 (01-04-2011)

  16. #11
    mnpeepno2's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    In a barren wasteland
    Posts
    905
    Reputation
    10
    Thanks
    81
    you can keep the label in the same position with this:

    (undah the timah)
    Code:
    label1.text = label1.text + label1.remove(1,label1.length) 'copies the first letter to the end
    label1.remove(0,1) ' removes the first letter
    so this would happen:

    scrolling
    crollings
    rollingsc
    ollingscr
    llingscro
    lingscrol
    ingscroll
    ngscrolli
    gscrollin
    scrolling

    and so on...
    Last edited by mnpeepno2; 12-31-2010 at 11:35 PM.

  17. #12
    cosconub's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    in the programming section MPGH Cash: $90,000,000,000
    Posts
    372
    Reputation
    -4
    Thanks
    39
    My Mood
    Psychedelic
    i used youtube i found a tut that works but doesn't reset

    A man is but the product of his thoughts what he thinks, he becomes.
    ~Mohandas Gandhi


    A Genius is nothing with out an idea, An idea is always an idea even without a genius.
    ~ Immortal

  18. #13
    Blubb1337's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Germany
    Posts
    5,915
    Reputation
    161
    Thanks
    3,108
    Quote Originally Posted by cosconub View Post
    i used youtube i found a tut that works but doesn't reset
    You don't need a non-working youtube tutorial for such task



  19. #14
    ken53406's Avatar
    Join Date
    Oct 2008
    Gender
    male
    Location
    In your moms slop hole :D
    Posts
    151
    Reputation
    9
    Thanks
    97
    My Mood
    Aggressive

    Talking

    Quote Originally Posted by Jason View Post


    Eugh, timer is a much better option unless you're running this in a different thread with proper delegates. System.Threading.Thread.Sleep sleeps the thread that the code was executed from, which in this case will be the UI thread. This means that during that sleep time, no other code on the UI thread will be executed. If you're trying to have scrolling text running asynchronously, either use a timer or another thread. The timer still runs on the UI thread, but won't lag the thread. Here's one with delegates and threading:

    [php]
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim scrollThread As New Threading.Thread(AddressOf Scrolling)
    scrollThread.Start()
    End Sub

    Private Delegate Sub MoveLabelInvoker(ByVal lbl As Label)

    Private Sub MoveLabel(ByVal lbl As Label)
    If lbl.InvokeRequired Then
    lbl.Invoke(New MoveLabelInvoker(AddressOf MoveLabel), lbl)
    Else
    If Not lbl.Left + lbl.Width <= 0 Then
    lbl.Left -= 1
    Else
    lbl.Left = Me.Width
    End If
    End If
    End Sub

    Private Sub Scrolling()
    Do
    MoveLabel(Me.Label1)
    System.Threading.Thread.Sleep(30)
    Loop
    End Sub
    [/php]

    Enjoy.
    As i stated my way would work better... Thanks for posting your shit jason, way better than mine and lollands good work!

    I also noticed no one thanked me, lolland, or jason for helping Bombs... I guess lately people have forgotten THERES A FUCKING THANKS BUTTON!!!!!!!!!
    Last edited by ken53406; 01-04-2011 at 11:06 AM.
    troll says: FUK YO COUCH NIGGA!
    V
    [img]https://www.******************/forums/images/smilies/troll_run.gif[/img]


    My goals list:
    Legend:

    Complete - Incomplete -

    30 Posts: [] | 50 Posts: []
    70 Posts: [] | 100 Posts: []
    500 Posts: [] | 1,000 Posts: []
    Release a CA NA pub: [] | Release a CFNA Pub: []
    Pro C++ Coder: [] | Pro VB Coder: []
    [IMG]https://images.encyclopediadramatic*****m/images/5/57/Pedobear_a.gif[/IMG]

    Don't forget:

  20. #15
    Hawky1337's Avatar
    Join Date
    Jun 2010
    Gender
    male
    Posts
    88
    Reputation
    11
    Thanks
    27
    My Mood
    Shocked
    Quote Originally Posted by ken53406 View Post
    As i stated my way would work better... Thanks for posting your shit jason, way better than mine and lollands good work!

    I also noticed no one thanked me, lolland, or jason for helping Bombs... I guess lately people have forgotten THERES A FUCKING THANKS BUTTON!!!!!!!!!
    That's common on MPGH

  21. The Following User Says Thank You to Hawky1337 For This Useful Post:

    ken53406 (01-05-2011)

Page 1 of 2 12 LastLast