Blink Radbutton with red background color.

5 posts, 1 answers
  1. RJ
    RJ avatar
    43 posts
    Member since:
    Jun 2010

    Posted 01 Feb 2014 Link to this post

     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
  2. Answer
    Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 03 Feb 2014 Link to this post

    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 >>
  3. UI for WinForms is Visual Studio 2017 Ready
  4. RJ
    RJ avatar
    43 posts
    Member since:
    Jun 2010

    Posted 03 Feb 2014 in reply to Stefan Link to this post

    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
  5. RJ
    RJ avatar
    43 posts
    Member since:
    Jun 2010

    Posted 03 Feb 2014 in reply to RJ Link to this post

    Hi Stefan,

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

    Thank you for all your help.

    RJ
  6. Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 04 Feb 2014 Link to this post

    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 >>
Back to Top
UI for WinForms is Visual Studio 2017 Ready