Picture shape point connection

Jan 6, 2013 at 7:19 PM

In my project I need change de connection point position in shape picture(fixed by me). Please help me.

 

Silvio Peluffo

Coordinator
Jan 14, 2013 at 7:53 AM

Hello Silvio,

before I can help you, I need to know in which way you want to change the connection point(s):

  • Do you want to deactivate it some connection points?
  • Do you want to add a new additional connection point?
  • Something else?
Coordinator
Jan 15, 2013 at 9:28 AM
Edited Jan 15, 2013 at 9:28 AM

Sorry, I overlooked the word "position" in "connection point position"...

In order to change only the position of a connection point, you have to override the method CalculateConnectionPoints().

Caution: If this connection point is also a "resize point", the shape may behave wrong when dragging this resize handle. In order to correct this, you have to override the method MovePointByCore() which is more complicated as you have to deal with rotation angles as the shape's outline is internally calculated without rotation.
In this case it may be easier for you to add an additional connection point (override property ControlPointCount and methods CalculateConnectionPoints(), and HasControlPointCapabilities()).

If you need sample code, have a look at the implementation of the folowing shapes:

  • Shapes that implement additional connection points that do not equal the resize handle's positions:
    • class DiamondBase (Core\RectangleShape.cs)
    • class EllipseBase (Core\RectangleShape.cs)
    • class CircleBase (Core\DiameterShape.cs)
    • class ProcessSymbol (FlowChartShapes\FlowChartShapes.cs)
  • Shapes that move connection/resize points to other locations:
    • class PreparationSymbol (FlowChartShapes\FlowChartShapes.cs)
    • class ExtractSymbol (FlowChartShapes\FlowChartShapes.cs)
    • class MergeSymbol (FlowChartShapes\FlowChartShapes.cs)
  • Shapes that omit certain connection- or resize points:
    • class IsoscelesTriangleBase (Core\RectangleShapes.cs)
    • class CommLinkSymbol (FlowChartShapes\FlowChartShapes.cs)
  • Shapes with completely custom connection- and resize points:
    • ThickArrow (GeneralShapes\MiscShapes.cs)
Jan 19, 2013 at 12:44 AM

 

Hello Kurt :

        Thanks for answering my request. My project is a generator of flowsheet for the sugar industry, for which I use a picture shape to put on the different drawings of equipment. These equipment have different inputs and outputs at arbitrary positions in the rectangle container. As it is not necessary to resize it,  I want to disable the standard handles and create one or more points of connection according to equipment drawing. I will try the suggestions made and will contact you again. If you have any additional comments , will be very useful. Thank you very much.

Jan 20, 2013 at 11:23 AM

Hello Kurt :

For many years I made  vb6 programs, including development of Flowsheet for the sugar industry. When I found NShape thought it would be great to improve my GUI. But at my 65 years I find it hard to learn C #, so I'm trying to improve with VB # (2010). I converted some examples and are functioning. Given my limited experience I find it difficult to move forward with the implementation of adding connection points on shape picture.¿ This possibility You may be standard in shape picture can be set with properties such as Width, Height or Image, etc ?. I will appreciate your response.  Thank you very much.