Hi I want to know if it is possible to create custom shapes and add them to the toolbox radDiagram, I need to create the figures shown in the attached image.
I hope you can help me.
I hope you can help me.
3 Answers, 1 is accepted
0
Accepted
Hello Carolina,
Thank you for writing.
The following article shows how you can create custom shapes: Custom shapes.
The following snippet shows how you can add the new shape to the toolbox:
Let me know if I can assist you further.
Regards,
Dimitar
Telerik
Thank you for writing.
The following article shows how you can create custom shapes: Custom shapes.
The following snippet shows how you can add the new shape to the toolbox:
DiagramListViewDataItem item =
new
DiagramListViewDataItem();
item.Key =
"MyShape"
;
item.Shape =
new
AShape();
item.Group = radDiagramToolbox1.Groups[0];
radDiagramToolbox1.Items.Add(item);
Let me know if I can assist you further.
Regards,
Dimitar
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Carolina
Top achievements
Rank 1
answered on 10 May 2016, 10:28 PM
Hello,
Thanks for the prompt response, I followed the instructions you provided me, but even I achievement not understand how I can create a shape that contains another figure inside as I show in the attached image.
As you can see in the diagram of the image I need to create a rectangular shape with a square black with a letter V inside, really have not much idea of how to do it.
I hope you can help me, receives a warm greeting.
Thanks for the prompt response, I followed the instructions you provided me, but even I achievement not understand how I can create a shape that contains another figure inside as I show in the attached image.
As you can see in the diagram of the image I need to create a rectangular shape with a square black with a letter V inside, really have not much idea of how to do it.
I hope you can help me, receives a warm greeting.
0
Hello Carolina,
Thank you for writing back.
You need to create a proper path. For example, you can add several rectangles to paint the border and the upper left part (the attached image shows the result on my side):
Please let me know if there is something else I can help you with.
Regards,
Dimitar
Telerik
Thank you for writing back.
You need to create a proper path. For example, you can add several rectangles to paint the border and the upper left part (the attached image shows the result on my side):
public
class
AShape : Telerik.WinControls.ElementShape
{
public
override
GraphicsPath CreatePath(Rectangle bounds)
{
GraphicsPath path =
new
GraphicsPath();
path.AddRectangle(
new
RectangleF(bounds.X, bounds.Y, 20, 20));
//left
path.AddRectangle(
new
RectangleF(bounds.X, bounds.Y + 20, 2, bounds.Height - 20));
//bottom
path.AddRectangle(
new
RectangleF(bounds.X + 2, bounds.Y + bounds.Height - 2, bounds.Width - 2, 2));
//top
path.AddRectangle(
new
RectangleF(bounds.X + 20, bounds.Y, bounds.Width - 20, 2));
//right
path.AddRectangle(
new
RectangleF(bounds.X + bounds.Width - 2, bounds.Y + 2, 2, bounds.Height - 4));
path.AddString(
"V"
,
new
FontFamily(
"Arial"
), 0, 10,
new
Point(5, 5), StringFormat.GenericTypographic);
return
path;
}
}
Please let me know if there is something else I can help you with.
Dimitar
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.