RadButton with Circle Shape Border

2 posts, 0 answers
  1. Mike
    Mike avatar
    16 posts
    Member since:
    Mar 2018

    Posted 23 Apr 2018 Link to this post

    Hello,

    I have a RadButton in a winform with a circle shape and an image.  

    The border of the button works fine when there the mouse is over the button, but one clicked and the mouse leaves the control, the border size seems to change.

    Please see the attached images.  The one "with mouse focus" was captured with a screen shot while the mouse was over the button, but the Windows screen grab does not show the mouse.  The "no mouse focus" image is after the button has been clicked and the mouse is no longer over the control.

    I have not been able to locate where to change the border setting when the button has been clicked, but does not have mouse focus.

    Any suggestions?

    Thanks

  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    4086 posts

    Posted 24 Apr 2018 Link to this post

    Hello, Mike,   

    There is a color applied to the ButtonElement.BorderElement.InnerColor which is illustrated in the attached screenshot. You can make it transparent and manipulate the ButtonElement.BorderElement.ForeColor when the control gets/looses focus. Here is a sample code snippet:
    public RadForm1()
    {
        InitializeComponent();
     
        this.radButton1.ButtonElement.Shape = new CircleShape();
     
        this.radButton1.GotFocus += radButton1_GotFocus;
        this.radButton1.LostFocus += radButton1_LostFocus;
     
        this.radButton1.ButtonElement.BorderElement.InnerColor = Color.Transparent;
    }
     
    private void radButton1_LostFocus(object sender, EventArgs e)
    {
        this.radButton1.ButtonElement.BorderElement.ForeColor = defaultBoderColor;
    }
     
    Color defaultBoderColor = Color.Empty;
     
    private void radButton1_GotFocus(object sender, EventArgs e)
    {
        defaultBoderColor = this.radButton1.ButtonElement.BorderElement.ForeColor;
        this.radButton1.ButtonElement.BorderElement.ForeColor = Color.FromArgb(255, 144, 0);
    }



    I hope this information helps. If you have any additional questions, please let me know. 

    Regards,
    Dess
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top