Here's how I did it:
Microsoft.Msagl.Drawing.Node visnode = new Microsoft.Msagl.Drawing.Node($"{n.NodeId}: {n.NodeName}") { UserData = n };
visnode.NodeBoundaryDelegate = GetNodeBoundary;
visnode.DrawNodeDelegate = DrawNode;
ICurve GetNodeBoundary(Microsoft.Msagl.Drawing.Node node) {
return CurveFactory.CreateRectangle(500, 50, new Microsoft.Msagl.Core.Geometry.Point(0,0) );
}
private bool DrawNode(Microsoft.Msagl.Drawing.Node node, object graphics)
{
Graphics g = (Graphics)graphics;
Node n = (Node)node.UserData;
// fiddle with g.transform (this took a ton of trial and error, and cribbing from
// the NodesWithImages sample code from MSAGL)
// see also https://stackoverflow.com/q/70855662/2112855
// g.FillRectangle, g.DrawString...
}