We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Custom Property Editor

Thread ID:





97749 Jan 5,2011 08:55 AM UTC Jan 11,2011 12:07 PM UTC WinForms 4
Tags: Diagram
Blanca Calderon
Asked On January 5, 2011 08:55 AM UTC


I am looking for a way to custom my property editor. If I show the properties of a line, I only want to show line style part and hide the others. Could you help me?

Thanks in advanced

Pandi Murugan A [Syncfusion]
Replied On January 6, 2011 07:44 AM UTC

Hi blanca,

Thanks for using Syncfusion products.

We suggest you to use Custom TypeConverter for Line to achieve your requirement. We have created a custom linetool with a custom line and have applied custom TypeConverter to the custom line as below.

//Custom Line class

class MyLine:Line
public MyLine()
: base()
public MyLine(PointF ptStart, PointF ptEnd)
: base(ptStart, ptEnd)

//Custom LineTool

class MyLineTool:LineTool
internal static string ToolName = "MyLineTool";
public MyLineTool(DiagramController controller)
: base(controller)
this.Name = ToolName;
protected override Node CreateNode(System.Drawing.PointF ptStart, System.Drawing.PointF ptEnd)
return new MyLine(ptStart, ptEnd);

//Custom TypeConverter

class LineTypeConverter:TypeConverter
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
return base.ConvertTo(context, culture, value, destinationType);

public override bool GetPropertiesSupported(ITypeDescriptorContext context)
return true;

public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
Attribute[] attrs = new Attribute[]
new BrowsableAttribute(true)

PropertyDescriptor[] props = null;
Type type = value.GetType();
switch (type.Name)
case "MyLine":
props = new PropertyDescriptor[1];
//Show LineStyle property Only
props[0] = TypeDescriptor.CreateProperty(typeof(MyLine), "LineStyle", typeof(LineStyle), attrs);

return new PropertyDescriptorCollection(props);

For your convenient, we have prepared a simple sample to demonstrate this and the same can be downloaded from the below link.


Kindly try the above sample and let me know if this helps.

Pandi Murugan A

Blanca Calderon
Replied On January 10, 2011 08:57 AM UTC

But If I want to show only LineWidth of the LineStyle collection and hide the others what do I have to do? And not only this, I want to show the LineWidth and MeasureUnits of General Node.

Thanks in advanced.

Best regards


Blanca Calderon
Replied On January 10, 2011 10:22 AM UTC

how do I refer to bounds collections, size?

Again thanks.

Pandi Murugan A [Syncfusion]
Replied On January 11, 2011 12:07 PM UTC

Hi Blanca,

Thanks for the update.
1. But If I want to show only LineWidth of the LineStyle collection and hide the others what do I have to do? And not only this, I want to show the LineWidth and MeasureUnits of General Node.

We regret to let you know that you cannot apply type converter to a Node in general. We suggest you to create custom shapes/connectors and apply type converter to them separately in order to achieve your requirement. Since LineStyle property is read only , you cannot set LineStyle which has custom type converter to a node in order to filter its LineWidth.

2. how do I refer to bounds collections, size?
We suggest you to use BoundingRectangle property of a Node to get its bounds and size. Please refer the below code snippet.

Syncfusion.Windows.Forms.Diagram.Rectangle rect = new Syncfusion.Windows.Forms.Diagram.Rectangle(10, 10, 100, 100);
SizeF nodeSize = rect.BoundingRectangle.Size;
PointF loaction = rect.BoundingRectangle.Location;
float top = rect.BoundingRectangle.Top;
float bottom = rect.BoundingRectangle.Bottom;
float right = rect.BoundingRectangle.Right;
float left = rect.BoundingRectangle.Left;

Please let me know if you have any concerns.

Pandi Murugan A


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon