How to Blink the Text in Windows Form Applications using with Timer control in C#.net
  • How to Blink the Text in Windows Form Applications using with Timer control in C#.net  

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

    namespace WindowsFormsApplication4
    {
        public partial class Form1 : Form
        {      
            private const int _blinkFrequency = 250;
            private const int _maxNumberOfBlinks = 1000;
            private int _blinkCount = 0;
           
           public Form1()
            {
                InitializeComponent();
                timer1.Interval = _blinkFrequency; //optional: set in design code
                label1.Text = "Welcome ";           
                timer1.Start();
            }

            private void timer1_Tick(object sender, EventArgs e)
            {           
                this.label1.Visible = !this.label1.Visible;
                _blinkCount++;        

                if (_blinkCount == _maxNumberOfBlinks * 2)
                {
                    timer1.Stop();
                   label1.Visible = true;              
                }
            }
           
        }
    }

     5. Run your application then you will get output like below:

    image

Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook

Popular Posts of the Week

    Optimum Creative