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

RADButton with rounded corner

9 Answers 1455 Views
Buttons, RadioButton, CheckBox, etc
This is a migrated thread and some comments may be shown as answers.
BB
Top achievements
Rank 1
BB asked on 12 Mar 2011, 08:53 PM

I need a RADButton with rounded corner.

The cornerradius should be flexible.

Thank you very much.

9 Answers, 1 is accepted

Sort by
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 14 Mar 2011, 10:09 AM
Hello

You can create a RadButton with rounded corners in the following way:

using Telerik.WinControls.UI;
using Telerik.WinControls;
  
public class RoundButton : RadButton
{
    public RoundButton()
        : base()
    {
  
    }
  
    public override string ThemeClassName
    {
        get
        {
            return typeof(RadButton).FullName;
        }
    
  
  
    protected override void OnLoad(System.Drawing.Size desiredSize)
    {
        RoundRectShape shape = new RoundRectShape();
  
        shape.BottomLeftRounded = true;
        shape.BottomRightRounded = true;
        shape.TopLeftRounded = true;
        shape.TopRightRounded = true;
        shape.Radius = 25;
        this.ButtonElement.Shape = shape;
  
        base.OnLoad(desiredSize);
    }
}

Hope this helps
Regards,
Richard
0
Richard Slade
Top achievements
Rank 2
answered on 15 Mar 2011, 10:43 AM
Hello,

Did this help? If so please remember to mark as answer. If you need further assistance, please let me know.
Thanks
Richard
0
Anubha
Top achievements
Rank 1
answered on 01 Mar 2012, 06:41 PM

<telerik:RadButton ID="RadButton1" Width="37px" Margin="5,5" runat="server" Skin=""

 

Height="22px" 

Text="12"

 CornerRadius="25" BorderColor="White"  

BorderStyle="Solid" ForeColor="White" BackColor="#CC3300"

 

 style="margin-left: 29px" AutoPostBack="False" BorderWidth="2px"   

 

Font-Bold="True" />

I tried this code but my button is not coming in raound shape. it is still coming in rectangle shape.  please help

 

0
Richard Slade
Top achievements
Rank 2
answered on 02 Mar 2012, 04:37 PM
Hello,

It looks like you need a different forum. Please ensure that you post your question in the correct forum so you get the quickest and most accurate answer
Thanks
Richard
0
Boryana
Telerik team
answered on 06 Mar 2012, 10:31 AM
Hello everyone,

Thank you for writing.

Anubha, you have already asked the same question in the correct forum, i.e. Silverlight: http://www.telerik.com/community/forums/silverlight/buttons/how-to-make-radbutton-with-rounded-edges.aspx. Please see expect our answer there.

Greetings,
Boryana
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
Bartley
Top achievements
Rank 1
answered on 04 Aug 2012, 04:51 AM
Hello,

I have just downloaded the winforms package and installed in vs2010. It appears that a radbutton with curved corners can only be obtained at run time. Is there any way to obtain a control with a click event that has curved corners in design mode?

Thanks,
bartj
0
Boryana
Telerik team
answered on 08 Aug 2012, 02:58 PM
Hello Bartley,

Thank you for writing.

Would you please explain in further details your requirements? By default RadButton is rendered in its ControlDefault theme at design time. Additionally, you can apply any of our predefined themes at design time, which also applies different shapes to the button. Do you want to set the shape of RadButton, so that it appears both at design and run time?

I am looking forward to your reply.

All the best,
Boryana
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Yehuda
Top achievements
Rank 1
answered on 11 Nov 2012, 04:50 PM
It works nice, but in the run time, when the control accepts focus, it is painted according to original button shape, i.s. like the button's shape has not been applied to the button. And, after the button loses the focus, or, while the focus is still on the button, the button is being painted correctly, 
0
Boryana
Telerik team
answered on 14 Nov 2012, 12:19 PM
Hello Yehuda,

Thank you for contacting us.

The issue illustrated in the image attached to your post is a result of the specific settings of the ControlDefault theme. By design, the Default state of RadButton requires a double border - the outer should be dark blue and the inner should be orange. If we use the standard double border drawing (through setting the BorderBoxStyle property to OuterInnerBorder), the inner border appears with glitches in the corners. In order to avoid the visual issue, in this state the ControlDefault theme assigns an ImageShape, which is rendered as a standard image ignoring the Shape you have applied to the control.

I have logged the aforementioned glitches to our Public Issue Tracker under ID 13399. To vote for it and subscribe for its status updates follow this link: http://www.telerik.com/support/pits.aspx#/public/winforms/13399. We will do our best to address the rendering issue in a future release, so that the ControlDefault theme design can be achieved without ImageShapes. 

Attached is a version of the ControlDefault theme that does not use an ImageShape. It introduces the glitches I have already mentioned if the shape is RoundRectShape with radius 2, however, it allows you to use any custom shape you would like. This is illustrated in the attached sample project. I hope you will find it useful.

Let me know if you have any further questions on this matter.

Kind regards,
Boryana
the Telerik team
Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
Tags
Buttons, RadioButton, CheckBox, etc
Asked by
BB
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Anubha
Top achievements
Rank 1
Boryana
Telerik team
Bartley
Top achievements
Rank 1
Yehuda
Top achievements
Rank 1
Share this question
or