How to set custom shape for radbutton

10 posts, 2 answers
  1. Giang
    Giang avatar
    6 posts
    Member since:
    Mar 2015

    Posted 01 Mar Link to this post

    I am working in winforms telerik controls. I have created custom shape for radbutton in my form but, whenever am running the application, the custom shape is not coming. Only default shape is coming. how to work out this.

    Note: I edited the button shape in smart tag -> edit UI elements ->radButton elements -> shape property ->new custom shap
  2. Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 02 Mar Link to this post

    Hello Giang,

    Thank you for writing.

    Depending on the theme you might need to set the Shape property of RadButtonElement, the FillPrimitive and the BorderPrimitive. For example with the default theme, setting the Shape on the RadButtonElement will suffice. 

    Should you still have issues, please let us know which properties precisely you changed so we can replicate the scenario on our end.

    I am looking forward to your reply.

    Regards,
    Stefan
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Giang
    Giang avatar
    6 posts
    Member since:
    Mar 2015

    Posted 02 Mar Link to this post

     Hi Stefan,

    Thank you for your support

    I created custom shape by edit the shape property of FillPrimitive and BorderPrimitive. I set the default theme for my scenario, custom shape has appeared in my design form but when i'm running the app, the default shape is still coming.

  5. Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 03 Mar Link to this post

    Hi Giang,

    It appears we have an issue when using custom shape at design time with RadButton. The case is logged here, where you can track for status changes: http://feedback.telerik.com/Project/154/Feedback/Details/173156-fix-radbutton-the-shape-is-reset-when-it-is-set-at-design-time-with-the-shape

    For the time being, you can apply the shape in code behind:
    radButton1.Shape = customShape1;

    Should you have any other questions or suggestions, do not hesitate to contact us.

    Regards,
    Stefan
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  6. Giang
    Giang avatar
    6 posts
    Member since:
    Mar 2015

    Posted 03 Mar in reply to Stefan Link to this post

    Follow your suggestion, i set the shape in code behind but it's not effective.

    If so, could you make a scenario and send me your demo
    Look forward to hearing from you.
  7. Answer
    Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 04 Mar Link to this post

    Hi Giang,

    One way to do that is to use the CustomShape API e.g.
    CustomShape shape1 = new CustomShape();
    shape1.CreateClosedShape(new PointF[] { new PointF(0, 0), new PointF(30, 0), new PointF(0, 30), new PointF(30, 20) } );
    radButton1.ButtonElement.Shape = shape1;

    Alternatively, you can use the shape editor form, to create your shape and then assign it to the desired control(s):
    CustomShapeEditorForm form = new CustomShapeEditorForm();
    CustomShape shape = new CustomShape();
    shape = form.EditShape(shape);
    radButton1.ButtonElement.Shape = shape;

    I hope this helps.

    Regards,
    Stefan
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  8. Giang
    Giang avatar
    6 posts
    Member since:
    Mar 2015

    Posted 11 Mar in reply to Stefan Link to this post

    hi Stefan,

    Thank you for your support. It works.
    i wonder that should i remove the background for the custom shape. when i place custom-shape side by side, they are overlap.
    I try to change backcolor and set border visible to hide but it not work
  9. Giang
    Giang avatar
    6 posts
    Member since:
    Mar 2015

    Posted 11 Mar Link to this post

    hi Stefan,

    Thank you for your support. It works.
    i wonder that should i remove the background for the custom shape. when i place custom-shape side by side, they are overlap.
    I try to change backcolor and set border visible to hide but it not work
  10. Answer
    Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 11 Mar Link to this post

    Hello,

    To clip the control bounds, you should set the ApplyShapeToControl property of the RootElement, and you should also set its Shape.

    Let me know how this works for you.

    Regards,
    Stefan
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  11. Giang
    Giang avatar
    6 posts
    Member since:
    Mar 2015

    Posted 13 Mar in reply to Stefan Link to this post

    Hi Stefan,

    That's work great !

    Thank you for your support.

Back to Top
UI for WinForms is Visual Studio 2017 Ready