Click here to Skip to main content
15,884,353 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to move a window label in label in windows application.
Is it possible, if yes then how?

I have seen it in VB
Posted
Updated 9-Jan-11 13:18pm
v3
Comments
Espen Harlinn 8-Jan-11 7:51am    
A vote of 1 is the same as telling me that my answer was dead wrong, please explain - I'm somewhat curious ...

Something like this :
A C# Scrolling Text Control[^]

Cheers
 
Share this answer
 
Comments
Espen Harlinn 8-Jan-11 9:40am    
5+, I thought Maruee was his girlfriend :) obvious now that spelling ahs bnee crroected ...
Set the label.Left and label.Top properties

Regards
Espen Harlinn
 
Share this answer
 
v2
Comments
Estys 8-Jan-11 8:07am    
He wants a marquee-style element.
Espen Harlinn 8-Jan-11 8:57am    
If that's the case, it was pretty hard to guess from the question ...
Estys 8-Jan-11 9:26am    
I also read the title : "maruee". My psychic powers insinuated a missing "q" in the middle :). Subsequently I edited the question a sneaked in an answer.
Espen Harlinn 8-Jan-11 9:36am    
Ahhh, good call, I missed that one :)
fjdiewornncalwe 8-Jan-11 13:12pm    
I'll +5 it, because your answer is correct based on the question when you answered. It isn't your fault that what he should have been doing was what Estys answered... Cheers.
class MarqueeLabel: Label
{
    private int CurrentPosition { get; set; }
    private Timer Timer { get; set; }

    public MarqueeLabel()
    {
        UseCompatibleTextRendering = true;
        Timer = new Timer();
        Timer.Interval = 25;
        Timer.Tick += new EventHandler(Timer_Tick);
        Timer.Start();
    }

    void Timer_Tick(object sender, EventArgs e)
    {
        if (CurrentPosition > Width)
            CurrentPosition = -Width;
        else
            CurrentPosition += 2;

        Invalidate();
    }

    protected override void OnPaint(PaintEventArgs e)
    {
        e.Graphics.TranslateTransform((float)CurrentPosition, 0);
        base.OnPaint(e);
    }

    protected override void Dispose(bool disposing)
    {
        if (disposing)
        {
            if (Timer != null)
                Timer.Dispose();
        }
        Timer = null;
    }
}


Hope it helps...
By Yatheesh Achar Kumble
 
Share this answer
 
you can navigate this link[^] to know how to create a Label Marquee.
 
Share this answer
 
Comments
arshad alam 10-Jan-11 5:00am    
your application is throwing an exception after closing this.. i think your dispose method is not defined properly..
RaviRanjanKr 11-Jan-11 9:24am    
Oh my God I have not made this Application. I've only refer you a link that might help you.
you can post your query to writer of Article.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900