This is a migrated thread and some comments may be shown as answers.

Blink Radbutton with red background color.

4 Answers 423 Views
Buttons, RadioButton, CheckBox, etc
This is a migrated thread and some comments may be shown as answers.
RJ
Top achievements
Rank 1
RJ asked on 01 Feb 2014, 10:44 PM
 Hi,

I would like to get the attention of the user by making the rad button blink and change the back color to red. How can this be done? Please advise.

Thanks
RJ

4 Answers, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 03 Feb 2014, 12:47 PM
Hi RJ,

Thank you for writing. 

The easiest way to achieve this is by using a timer. Here is a small sample:
protected override void OnLoad(EventArgs e)
{
    base.OnLoad(e);
 
    System.Windows.Forms.Timer timer = new Timer();
    timer.Interval = 200;
    timer.Tick += timer_Tick;
    timer.Start();
}
 
void timer_Tick(object sender, EventArgs e)
{
    if (radButton1.ButtonElement.ButtonFillElement.BackColor == Color.Red)
    {
        radButton1.ButtonElement.ButtonFillElement.ResetValue(FillPrimitive.BackColorProperty, ValueResetFlags.Local);
        radButton1.ButtonElement.ButtonFillElement.ResetValue(FillPrimitive.GradientStyleProperty, ValueResetFlags.Local);
    }
    else
    {
        radButton1.ButtonElement.ButtonFillElement.GradientStyle = GradientStyles.Solid;
        radButton1.ButtonElement.ButtonFillElement.BackColor = Color.Red;
    }
}

I hope this helps. 

Regards,
Stefan
Telerik
TRY TELERIK'S NEWEST PRODUCT - APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
RJ
Top achievements
Rank 1
answered on 03 Feb 2014, 03:41 PM
Hi Stefan,

Thanks so much, this works perfectly. In the buttons click event, I stopped the timer and tried to reset the button but the buttons border stayed red. How can I bring it back to its default state.

RJ
0
RJ
Top achievements
Rank 1
answered on 03 Feb 2014, 04:37 PM
Hi Stefan,

I just released that the border was showing because the button still had focus.

Thank you for all your help.

RJ
0
Stefan
Telerik team
answered on 04 Feb 2014, 11:48 AM
Hello,

You are welcome. I hope everything is OK now.

Regards,
Stefan
Telerik
TRY TELERIK'S NEWEST PRODUCT - APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
Buttons, RadioButton, CheckBox, etc
Asked by
RJ
Top achievements
Rank 1
Answers by
Stefan
Telerik team
RJ
Top achievements
Rank 1
Share this question
or