GoTextNode with graphic?

I read an older post on this but the code sample does not seem to match the current interface for the GoTextNode.
I want to use a GoTextNode with an Icon displayed in the upper left and the text displayed to the right of the icon. The GoTextNode wants to strech the icon (.bmp, .gif or .jpg) to fit the size of the text.
If I set this.AutoResizes = true;, the image is streched.
I I set this.AutoResizes = false;, the image is the size of the image with no text displayed.
I can’t seem to get both. Here’s the constructor for my subclass of GoTextNode:

public DependencyNode()
{
this.LeftPort = null;
this.RightPort = null;
// assume marriage links can both come into and go out of
// the BottomPort from any direction
this.BottomPort.FromSpot = NoSpot;
this.BottomPort.ToSpot = NoSpot;
GoImage img = new GoImage();
img.Name = @"C:\Projects\DiagramView\images\job.gif";
img.Size = new Size(32, 32);
img.Selectable = false;
img.AutoResizes = false;
img.AutoRescales = false;
this.TopLeftMargin = new Size(36, 4);
img.Position = new PointF(this.Left+2, this.Top+2);
this.AutoResizes = true;
this.Background = img;
this.Selectable = false;
}

Do you want GoTextNode.AutoResizes to be true or false? If you set it and leave it false, I think it should work. But setting it back to true again will cause the Background to be resized to fit around the text, which means your GoImage will be resized to fit around the text.
Instead of setting GoTextNode.Background to be your GoImage, why not just Add the GoImage to the GoTextNode?

I tried setting the AutoResizes to false but no luck.
I’m not seeing an Add method to add the image to the GoTextNode. I did see that this is the way it was done in the old post, but I’m not seeing away to add the image as it is not in the documentation and the method does not showup with intelisense.
When I add it to the code (this.Add(img);), I get the following error:
C:\projects\DiagramDependency\DependencyNode.cs(96): ‘Northwoods.Go.GoGroup.Add(Northwoods.Go.GoObject)’ is inaccessible due to its protection level

I’m not sure why this would be protected.

So I tried this with GoDiagram rather than GoExpress. I am licensed for GoExpress. It works with GoDiagram when I use the Add method that is not available under GoExpress. Apparently, there must be some difference in setting the background to an image as opposed to adding the image with the add method.
Is this a bug? The behavior I get under GoDiagram is what I want and what I would expect under GoExpress too. The ability to use GoTextNodes with an image should be supported under GoExpress right?

Yes, GoDiagram Express is much simpler than GoDiagram Win, and one of the simplifications is that grouping isn’t really supported.
So if you want to have two objects in the background, both a GoImage and a GoRectangle, you would need to use GoDiagram Win.
But I think you can use GoDiagram Express if you just have an image as the Background, as your code does. Override GoTextNode.LayoutChildren to size and position the Background object (i.e. your GoImage) the way you want it to be relative to the Label, and then position the ports where you want them to be, presumably relative to the Label and maybe to the Background image.
Here’s the standard definition of GoTextNode.LayoutChildren, from which I hope you can gain some understanding of the standard behavior that you want to replace:
public override void LayoutChildren(GoObject childchanged) {
if (this.Initializing) return;
GoText label = this.Label;
if (label == null) return;
GoObject back = this.Background;
if (back != null) {
SizeF topleft = this.TopLeftMargin;
SizeF bottomright = this.BottomRightMargin;
if (this.AutoResizes) {
back.Bounds = new RectangleF(label.Left - topleft.Width,
label.Top - topleft.Height,
label.Width + topleft.Width + bottomright.Width,
label.Height + topleft.Height + bottomright.Height);
} else {
float maxLabelWidth = Math.Max(back.Width - (topleft.Width + bottomright.Width), 0);
float maxLabelHeight = Math.Max(back.Height - (topleft.Height + bottomright.Height), 0);
label.Width = maxLabelWidth;
label.WrappingWidth = maxLabelWidth;
label.UpdateSize();
float labelHeight = Math.Min(label.Height, maxLabelHeight);
float labelLeft = back.Left + topleft.Width;
float labelTop = back.Top + topleft.Height + (maxLabelHeight-labelHeight)/2;
label.Bounds = new RectangleF(labelLeft, labelTop, maxLabelWidth, labelHeight);
}
}
// in case there is no Background, position the ports around the text Label instead
if (back == null && this.AutoResizes)
back = label;
if (back != null) {
if (this.TopPort != null)
this.TopPort.SetSpotLocation(MiddleTop, back, MiddleTop);
if (this.RightPort != null)
this.RightPort.SetSpotLocation(MiddleRight, back, MiddleRight);
if (this.BottomPort != null)
this.BottomPort.SetSpotLocation(MiddleBottom, back, MiddleBottom);
if (this.LeftPort != null)
this.LeftPort.SetSpotLocation(MiddleLeft, back, MiddleLeft);
}
}

Obviously in your code you don’t have heed the AutoResizes, TopLeftMargin, and BottomRightMargins properties if you don’t want to.

[Serializable]
public class ImageTextNode : GoTextNode {
public ImageTextNode() {} public void Initialize(String imgname, String text) {
GoImage img = new GoImage();
img.Name = imgname;
this.Background = img;
this.Text = text;
} public override void LayoutChildren(GoObject childchanged) {
if (this.Initializing) return;
GoObject back = this.Background;
GoObject label = this.Label;
if (back != null && label != null) {
back.Bounds = new RectangleF(label.Left - 18, label.Top, 16, 16);
if (this.TopPort != null)
this.TopPort.SetSpotLocation(MiddleTop, label, MiddleTop);
if (this.RightPort != null)
this.RightPort.SetSpotLocation(MiddleRight, label, MiddleRight);
if (this.BottomPort != null)
this.BottomPort.SetSpotLocation(MiddleBottom, label, MiddleBottom);
if (this.LeftPort != null)
this.LeftPort.SetSpotLocation(MiddleLeft, back, MiddleLeft);
}
}
} Usage: ImageTextNode itn = new ImageTextNode();
itn.Initialize(@"star.gif", "star");
itn.Position = new PointF(350, 200);
doc.Add(itn);