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. Image for the cookie policy date
close icon

rounded rectangle corner radius scaling

hi,

when using a rounded rectangle i would like to offer a port (snap point for connector lines) exactly on the corner radius of the shape. However, when the user scales the shape the port position scales with the shape, but the corner radius remains constant (set via property curveRadius). Hence, the connector line appears to join inside the rounded rectangle as opposed to joining on the boundary of the shape.

Is there a way to make the rounded rectangle corner radius scale with the shape when being resized?



I found an old forum post that suggests the behavior that I am looking for used to be the standard scaling behavior:

http://www.syncfusion.com/support/forums/message.aspx?MessageID=45110



9 Replies

J. J.Nagarajan Syncfusion Team July 15, 2008 09:20 AM UTC

Hi ,

Thanks for your interest in Syncfusion products.

You can adjust the ConnectionPoint in the NodeSizeChanged event to display the port at the corner of the node. Please refer to the following code snippet.

float Offset=115;
void EventSink_SizeChanged(SizeChangedEventArgs evtArgs)
{
Node m_node = evtArgs.NodeAffected as Node;
Offset = Offset + evtArgs.Offset.Width;
Console.WriteLine(Offset + evtArgs.Offset.Width);

m_node.Ports[1].OffsetX = Offset ;

m_node.Ports[1].OffsetY = 6;

this.diagram1.Refresh();
}

Please refer to the attached sample for more details.

http://websamples.syncfusion.com/samples/Diagram.Windows/45110/main.htm

Please let me know if this helps.

Regards,
Nagaraj



PM Peter Mcintosh July 21, 2008 11:19 AM UTC

Thanks for the reply Nagarajan. However, this is not working for me:

1. If you make the rounded rectangle small, it eventually affects the radius of the corner curve and at this point the anchor is inside the rectangle, not on the border.

2. I was getting exceptions in your event handler "EventSink_SizeChanged" - 'System.ArgumentOutOfRangeException' as the values were sometimes negative.

3. I would prefer the rounded rectangle radius to always scale (i.e not just when it becomes very small). For example, if the radius is 10 when the rectangle width is 100, I would like the radius to be 20 when the rectangle width is scaled to 200.

On another note - I have problems opening your examples as you do not include your libs with the solution. I am currently using v6.3.0.6 libs. I had to remove some of your code to allow the project to build.

I hope you can help me further...



J. J.Nagarajan Syncfusion Team July 21, 2008 11:53 AM UTC

Hi ,

I have logged a feature request to change the CurveRadius according to the size of RoundRectangle. I will get back to you with more details regarding this feature on or before 25th July.

Please refer to the attached sample that works fine in v6.3.0.6. It should not throw exception on EventSink_SizeChanged event.

http://www.syncfusion.com/Product/uploads/Diagram_RoundedRect_bcd9b1e9.zip

Please let me know if this helps.

Thanks,
Nagaraj



PM Peter Mcintosh July 21, 2008 01:18 PM UTC

Thanks again for your swift reply Nagaraj.

I still cannot build the solution you sent without editing the project - I get the following build error:

Error 1 Invalid Resx file. Could not load type Syncfusion.Windows.Forms.Diagram.PageScale, Syncfusion.Diagram.Base, Version=6.302.0.25, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89 which is used in the .RESX file. Ensure that the necessary references have been added to your project. Line 134, position 5. D:\My Documents\Visual Studio Projects\syncfusion\Diagram_RoundedRect3\Diagram_RoundedRect\MainForm.resx 134 5 QuickStart_2008



If you make the rounded rectangle small, when it eventually affects the radius of the corner curve the anchor is still ending up inside the rectangle, not on the border.

I did not get the exception this time (although I did not spend much time testing it as it still does not meet my requirements).

In the short term (i.e. until the feature request for the radius to scale is fulfilled) is it possible to have the anchor point always remain on the border of the curved corner?

Thanks again.
mcinp



J. J.Nagarajan Syncfusion Team July 22, 2008 05:45 AM UTC

Hi ,

Sorry for the inconvenience caused. I have modified the sample and this sample works fine in v6.3.0.6.

http://websamples.syncfusion.com/samples/Diagram.Windows/F75098_July22/main.htm

When the RoundRectangle is made small, the ConnectionPoint is still on the corner. Please refer to the attached video file that shows my test result.

http://www.syncfusion.com/Product/uploads/Video_47ae3263.zip

Could you please provide us a video file that shows this issue on your side.

Thanks,
Nagaraj




PM Peter Mcintosh July 22, 2008 09:27 AM UTC

Thanks Nagaraj - I was able to build your latest solution.

I have attached an example of using your code - When the rounded rectangle is small the connection point is not correct.

Regards,
mcinp





portWrongExample_c855cc56.zip


J. J.Nagarajan Syncfusion Team July 22, 2008 11:18 AM UTC

Hi ,

Thanks for the attachment. We need to do some source level changes to change the CurveRadius according to the size of RoundRectangle. I will get back to you with more details regarding this feature on or before 25th July.

Thanks,
Nagaraj






PM Peter Mcintosh August 5, 2008 01:50 PM UTC

Hi Nagaraj,
Any update on this issue/fix?
Thanks,
mcinp



J. J.Nagarajan Syncfusion Team August 7, 2008 10:13 AM UTC

Hi ,

I have consulted with our developers and this feature will be implemented on 7th December, 2008. I will get back to you with the patch including this feature on or before 7th December,2008.

Thanks for your patience.

Regards,
Nagaraj


Loader.
Live Chat Icon For mobile
Up arrow icon