Change radiobutton colour when hovered

2 posts, 0 answers
  1. Kgopelo
    Kgopelo avatar
    1 posts
    Member since:
    Jun 2014

    Posted 01 Aug 2014 Link to this post

    Hey all.I have been searching to change a background colour of a radbutton when hovered.I found exactly what I was looking for here
    When I run the program, all is well.But when I try to implement that exact code in my project it does not work.Is there something I am missing.Bear with me as I am a newbie.

    Kind Regards,
  2. Dimitar
    Admin
    Dimitar avatar
    1415 posts

    Posted 05 Aug 2014 Link to this post

    Hello Kgopelo,

    Thank you for writing.

    The provided example just changes the BackColor when the button is not hovered. To change the hover color you can use the MouseEnter and MouseLeave events: 
    void radButton1_MouseLeave(object sender, EventArgs e)
    {
        radButton1.ButtonElement.ButtonFillElement.ResetValue(FillPrimitive.BackColorProperty,
            Telerik.WinControls.ValueResetFlags.Local);
        radButton1.ButtonElement.ButtonFillElement.ResetValue(FillPrimitive.GradientStyleProperty,
            Telerik.WinControls.ValueResetFlags.Local);
    }
     
    void radButton1_MouseEnter(object sender, EventArgs e)
    {
        radButton1.ButtonElement.ButtonFillElement.BackColor = Color.FromArgb(153, 204, 55);
        radButton1.ButtonElement.ButtonFillElement.GradientStyle = Telerik.WinControls.GradientStyles.Solid;
    }

    Please let me know if there is something else I can help you with. 
     
    Regards,
    Dimitar
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top