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

How to set custom shape for radbutton

13 Answers 563 Views
Buttons, RadioButton, CheckBox, etc
This is a migrated thread and some comments may be shown as answers.
Giang
Top achievements
Rank 1
Giang asked on 02 Mar 2016, 12:50 AM
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

13 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 02 Mar 2016, 07:16 AM
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
0
Giang
Top achievements
Rank 1
answered on 03 Mar 2016, 01:43 AM
 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.

0
Stefan
Telerik team
answered on 03 Mar 2016, 09:12 AM
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
0
Giang
Top achievements
Rank 1
answered on 04 Mar 2016, 12:49 AM
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.
0
Accepted
Stefan
Telerik team
answered on 04 Mar 2016, 06:53 AM
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
0
Giang
Top achievements
Rank 1
answered on 11 Mar 2016, 09:18 AM
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
0
Giang
Top achievements
Rank 1
answered on 11 Mar 2016, 09:20 AM
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
0
Accepted
Stefan
Telerik team
answered on 11 Mar 2016, 01:05 PM
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.
0
Giang
Top achievements
Rank 1
answered on 14 Mar 2016, 12:55 AM

Hi Stefan,

That's work great !

Thank you for your support.

0
bla
Top achievements
Rank 1
Veteran
answered on 19 Aug 2020, 10:46 AM

Hello, Telerik. I really have the question in the title. As the creater actually wanted to know something totally different, I cannot set any shapes. There is just no shape (and others) property. How can that happen?

I am using VS 2019 (16.0.0), .NET 4.7.2, C#, WinForms, Telerik UI for WinForms R1 2019.

0
Nadya | Tech Support Engineer
Telerik team
answered on 19 Aug 2020, 12:19 PM

Hello,

If you want to set a custom shape to RadButton, you can create the shape that you want and just assign it to Shape property of the button as shown below:

RoundRectShape shape = new RoundRectShape(20);
this.radButton1.ButtonElement.Shape = shape;

In addition, you can refer to the following articles: 
https://docs.telerik.com/devtools/winforms/telerik-presentation-framework/shapes/custom-shapes
https://docs.telerik.com/devtools/winforms/controls/buttons/button/customizing-appearance/accessing-and-customizing-elements

Should you have further question please let me know.

Regards,
Nadya
Progress Telerik

0
bla
Top achievements
Rank 1
Veteran
answered on 19 Aug 2020, 01:02 PM

Hi Nadya,

thanks for the fast answer!

But the problem stays: There is no property "Shape"! Also in the code behind the object doesn't have that field. So how can it leave or do i need to active or install extensions for that...?

0
Nadya | Tech Support Engineer
Telerik team
answered on 24 Aug 2020, 08:39 AM

Hello,

RadButton offers Shape property which is accessible through RadButtonElement and allows a custom shape to be applied. See the picture below:

This comes out of the box and does not require any extensions to be installed.

If you are not able to see the Shape property could you confirm that you are using RadButton, not the standard MS Button? The standard MS Button does not have Shape property. I attached a project where a RadButton with a custom shape is added. Could you please give it a try and let me know hot it works for you?

Looking forward to your reply.

Regards,


Nadya
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive , special prizes and more, for FREE?! Register now for DevReach 2.0(20).

Tags
Buttons, RadioButton, CheckBox, etc
Asked by
Giang
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Giang
Top achievements
Rank 1
bla
Top achievements
Rank 1
Veteran
Nadya | Tech Support Engineer
Telerik team
Share this question
or