Share via


c# button as blinking

Question

Thursday, July 2, 2009 4:35 AM

i have a form in c# with a button button1,

how  i can set my button1 look like blinking

regards
sadique

All replies (5)

Thursday, July 2, 2009 6:13 AM

Sure.
Just, prepare a animated blinking GIF Image.
Now, link this image to to the button. Done.Regards, Lakra :) - If the post is helpful or answers your question, please mark it as such.


Saturday, July 4, 2009 4:39 AM

ok how i can set my color(button1) randomly using timer

regards


Monday, July 6, 2009 5:05 AM | 5 votes

Place the Time control on your form. Set the following properties of the Timer -->
>> Interval = 500. This interval value would be better to observe in GUI.
>> Enabled = False

On the click event of the Timer:

private void timer1_Tick(object sender, EventArgs e)
{
    if (button1.BackColor == Color.Gray)
    {
        button1.BackColor = Color.Red;
    }
    else
    {
        button1.BackColor = Color.Gray;
    }
}

If you wish to start the button's blinking with the Form Load itself, add the following code in the Form_Load event:

timer1.Start();

That's it. Happy Coding!
Please remebebr to post your queries as a QUESTION and not as a Discussion, if you have a query.Regards, Lakra :) - If the post is helpful or answers your question, please mark it as such.


Saturday, March 15, 2014 6:09 AM

it obtain error like as

Error 1 The name 'Color' does not exist in the current context E:\NET MATERIALS\my project\HOME.aspx.cs 48 33 E:\NET MATERIALS\my project\


Saturday, March 15, 2014 7:00 AM

Please post ASP.NET related questions in the ASP.NET forums: http://forums.asp.net