RADButton with rounded corner

10 posts, 1 answers
  1. BB
    BB avatar
    13 posts
    Member since:
    Mar 2007

    Posted 12 Mar 2011 Link to this post

    I need a RADButton with rounded corner.

    The cornerradius should be flexible.

    Thank you very much.

  2. Answer
    Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 14 Mar 2011 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 15 Mar 2011 Link to this post

    Hello,

    Did this help? If so please remember to mark as answer. If you need further assistance, please let me know.
    Thanks
    Richard
  5. Anubha
    Anubha avatar
    2 posts
    Member since:
    Mar 2012

    Posted 01 Mar 2012 Link to this post

    <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

     

  6. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 02 Mar 2012 Link to this post

    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
  7. Boryana
    Admin
    Boryana avatar
    330 posts

    Posted 06 Mar 2012 Link to this post

    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 >>
  8. Bartley
    Bartley avatar
    3 posts
    Member since:
    Aug 2012

    Posted 03 Aug 2012 Link to this post

    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
  9. Boryana
    Admin
    Boryana avatar
    330 posts

    Posted 08 Aug 2012 Link to this post

    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 >>
  10. Yehuda
    Yehuda avatar
    6 posts
    Member since:
    Jun 2010

    Posted 11 Nov 2012 Link to this post

    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, 
  11. Boryana
    Admin
    Boryana avatar
    330 posts

    Posted 14 Nov 2012 Link to this post

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