Odify rectangle when a node is selected

Hello all,

Sorry to ask such an easy question but I am completly lost in the GoDiagram documentation. You can trust me that I searched a lot before asking you this question …

How can I modify the way my nodes/nodeports/transitions are when they are selected.

When I select a node or a nodeport a yellow green colored rectangle appear around this. I would like to keep this rectangle but modify the width of the lines and the color of my rectangle.

How I can do that?

For my transition I can use an highlight method but I can’t for Node/nodeport …


J-L Mouillet

Sure. The selected items are contained in the collection view.Selection. So, it is just a matter of having some UI to pick a new color, and iterating through that collection and setting the color (checking the type of object for “node” or “link” first).

Another way to do it is to use the Go.Drawing UI controls for Pen, Brush and Font. See the DrawDemo or Statecharter samples.

Hi again,

First thanks for your previous help.

By default I have a greenyellow rectangle around my node when selected, how can I delete this rectangle to set my own design when I will select a node? (I will do that overriding OnGotSelection() of GoBasicNode).


The Selection class (GoView.Selection) has methods for CreateBoundingHandle and CreateResizeHandle. The GoObject calls these methods in GoObject.AddSelectionHandles to add the selection handles.

You can override GoObject.AddSelectionHandles (for the node’s SelectionObject, not necessarily the node itself) to change the way way handles are created.

Search through the samples for different examples.

thanks for your reply.

Finally I set the GoView “Primary SelectionColor” to empty and I overrided the OnGotSelection / OnLostSelection to change my node color.

However I have another problem :

When I set HighlightWhenSelected to true, small square to modify manually the curve of my link disappear!!!

When I don’t set HighlightWhenSelected to true my small squares to modify the curve appear…

How can I put back this port?

Sorry to be that bad using GoDiagram …

PS : one more time I searched a lot in the documentation and I tried differetns things …

JL Mouillet

oh… you just want to change the node’s color when selected? You should have said so…

public override void AddSelectionHandles(GoSelection sel, GoObject selectedObject) {

// make sure there aren’t any left-over handles


this.SkipsUndoManager = true;

this.BrushColor = Color.FromArgb(200, 200, 200);

this.SkipsUndoManager = false;


and set it back with:

public override void RemoveSelectionHandles(GoSelection sel) {

this.SkipsUndoManager = true;

this.BrushColor = Color.FromArgb(0, 115, 250);

this.SkipsUndoManager = false;



(code extracted from the Pipes sample)

and leave PrimarySelectionColor as the default.