LINE SHAPE IN WINDOWS FORM

Jaya J

Total Post:9

Points:63
Posted by  Jaya J
C# 
 874  View(s)
Ratings:
Rate this:
I have draw a line shape in windows form using Toolbox.Now i want to Blink that line shape when button was clicked at runtime.Tell me anyone is it possible in windows form using c#..If Possible tell me how to write the code.
  1. Sumit Kesarwani

    Post:378

    Points:2694
    Re: Line Shape in Windows Form

    Hi Jaya, 

                You can use a timer for this. On tick event of timer set line shape visibility to true and false and you can stat the timer on the button click like this:

    namespace WindowsFormsApplication3
    {
        public partial class Form1 : Form
        {
            Timer timer = new Timer();
            public Form1()
            {
                InitializeComponent();
            }

            private void button1_Click(object sender, EventArgs e)
            {
                timer.Start();
            }

            private void Form1_Load(object sender, EventArgs e)
            {
               
                timer.Interval = 1000;
                timer.Enabled = true;
                timer.Tick += new System.EventHandler(timer_Tick);
            }

            private void timer_Tick(object sender, EventArgs e)
            {
                if (lineShape.Visible)
                {
                    lineShape.Visible = false;
                }
                else
                {
                    lineShape.Visible = true;
                }
            }
        }
    }

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!