Click here to Skip to main content
12,890,388 members (57,772 online)
Click here to Skip to main content
Add your own
alternative version


21 bookmarked
Posted 3 Oct 2008

Rolling label

, 3 Oct 2008 CPOL
Rate this:
Please Sign up or sign in to vote.
A user control which is rolling text from right to left


This control rolls text circularly from right to left.

Using the code

You just need to set two properties for it as following.
When speed set to zero it will stop rolling.

public partial class RollLabel : UserControl
    private int m_speed = 5;

    public RollLabel()

    public string Text
        get { return lblMsg.Text; }
        set { lblMsg.Text = value; }

    public int Speed
        get { return m_speed; }
            if (value < 0)
                throw new ArgumentOutOfRangeException();
            m_speed = value;

    private void RollLabel_Resize(object sender, EventArgs e)
        lblMsg.Top = (this.Height - lblMsg.Height) / 2;
        lblMsg.Left = this.Width;

    private void timer1_Tick(object sender, EventArgs e)
        lblMsg.Left = lblMsg.Left - m_speed;
        if (lblMsg.Left <= -lblMsg.Width)
            lblMsg.Left = this.Width;



This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Saloman Wu
Software Developer (Senior)
China China
No Biography provided

You may also be interested in...

Comments and Discussions

Generalhello not work test sample Pin
hjozi4-Oct-08 2:56
memberhjozi4-Oct-08 2:56 
GeneralRe: hello not work test sample Pin
Saloman Wu5-Oct-08 15:33
memberSaloman Wu5-Oct-08 15:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170424.1 | Last Updated 4 Oct 2008
Article Copyright 2008 by Saloman Wu
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid