Background icon for PinNode


Does anyone know if it is possible to add a background icon to a PinNode (the modified GoTextNode used in the GoDiagram samples)?
I am having trouble making it work. I am using a GoImage object and loading it with an icon file (.ico) contained in my project.
Alternatively, would it be possible to add an icon to the PinNode and position it in a corner ?
Any help would be greatly appreciated.


You didn’t say what your problem was.
If you create and initialize a GoImage and add it to your document, does it display what you want?
If not, then you’re having some kind of problem referring to the image. Chances are there’s a naming problem getting the right ResourceManager.
If so, then you just need to size and position that GoImage the way you want and Add it to the PinNode.


The problem is that the PinNode is displayed withour my icon. I’m not getting any error and my GoImage properly loads my icon.
Here’s what I’m trying:
GoImage myImage = new GoImage();
myImage.ResourceManager =
new System.Resources.ResourceManager(typeof(MyForm));
Check.Require(myImage.ResourceManager != null,
“There was a problem getting the ResourceManager”);
myImage.Name = @“C:\MrnMicro\VSS\DendroDIF\DendroDIF\Composant\EditeurRegle Affaire\Erreur.ico”;
// myNode is a valid PinNode that is displayed properly but without an icon
myNode.Background = myImage;
myNode.Background.Visible = true;


A few comments:
The call to LoadImage() is unnecessary, as is setting .Visible to true. (But you were probably trying different things to make it work.)
Once you have replace the Background object, it has already been Added to the node, so the explicit call to myNode.Add(myImage) is a no-op.
I’m surprised you don’t get an error trying to goDocument.Add(myImage), because myImage is already part of a node. If errors are being handled silently, perhaps this is why it doesn’t seem to work for you.
You don’t set the Bounds of myImage. If you just want its default size, that’s OK–but if you are going to replace the Background, you probably should set at least the Position of myImage before you set the node’s Background.


Thanks Walter, it seems I needed to set my image’s position before setting the background. It’s working fine now.
I appreciate your help.