I have been playing with GoDiagram for a few hours now.
I’m trying to create a node that is a rounded rectangle, with one port on the top, and two or three ports on the bottom., I would also like to some text into the node and possibly an icon. Where would I need to look for that, the rounded rectangle class doesn’t allow me to add ports, or text onto it, (Or I’m looking in the wrong place)
I have attached an image of what I’m trying to achieve, I want to create something simiar to the DSL tools in Visual Studio Team System:
First, although you want to use a rounded rectangle class, that’s all it is – just a shape with a Brush and a Pen. It does not have (and cannot have) any ports or text or images or any other decorations.
Instead you want to define your own GoNode class, and add various GoShape, GoText, GoImage, GoPort and GoGroup objects to it. (GoNode inherits from GoGroup, so you can add parts to the node.)
There are a bunch of example classes in Demo1 that you might find useful. Perhaps you could even modify some of them for your purposes. The InfoNode… classes might be instructive, as might be ClassDiagramNode. Note that most (all?) employ nesting of groups.
You didn’t show any examples of ports, unless that hexagonal thing at the top is supposed to be a port.
Basically you could define a GoNode-inheriting class that includes an Initialize method that creates the child objects you want. Your picture seems to want to have a LinearGradientRoundedRectangle for the background, a GoHexagon, a GoImage (inside the hexagon), a bold GoText (inside the rectangle), a GoImage (below the text), and another GoText (to the right of the image). Or maybe the hexagon and the image inside the hexagon are just one image – I don’t know how you expect to use it. And I don’t know how many ports you’ll want, and what they should look like, and where they should be positioned.
You’ll want to implement an override of LayoutChildren to position all of these child objects where you want them to be relative to the rectangle, so that as the text (and any other objects) change size, they will all be sized and positioned as desired.
Thanks for the response, Thats all i needed i quick pointer in the right direction :)
I’ll give it a go and see what I can come up with.