Create animated label in windows forms

Pardhu2020
Posted by in Windows Forms category on for Beginner level | Points: 250 | Views : 4655 red flag
Rating: 5 out of 5  
 1 vote(s)

Hi friends today lets discuss about how to create animated label in windows forms.


 Download source code for Create animated label in windows forms

  1. Once open the Visual Studio click on File Click on the Project .


  1. Select on Windows Forms Application 
  2. Change the name as per your requirement 

  1. Right Click on the project and add a form and rename as Animated_Label_Demo

  1. Add a new label and change the text as Animated Label

  1. From ToolBox Select a Timer and drag and drop on windows form
Right click on the time and Enable into TRUE and change the interval as per your requirement


Lets look into code behind file

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class AninatedLabel : Form
    {
        public AninatedLabel()
        {
            InitializeComponent();
        }        
    }
}
Double Click on the timer . you will get a timer event timer1_TickHave a look on the above code we need to apply animation to a label This event will fire and color will change

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class AninatedLabel : Form
    {
        public AninatedLabel()
        {
            InitializeComponent();
        }

        private void timer1_Tick(object sender, EventArgs e)   // timer event
        
        {
            if (label1.BackColor != Color.Red)

                label1.BackColor = Color.Red;
            else
                label1.BackColor = Color.Green;


        }
    }
}




Output :

          


Conclusion

In this article we have seen how apply animation to the label in windows form.
Page copy protected against web site content infringement by Copyscape

About the Author

Pardhu2020
Full Name: Pardha Saradhi
Member Level:
Member Status: Member
Member Since: 3/19/2013 2:21:22 PM
Country: India

http://www.dotnetfunda.com

Login to vote for this post.

Comments or Responses

Login to post response

Comment using Facebook(Author doesn't get notification)