Thanks!!
It works great, except when I combine this with my previous request. If I have this:
void diagram_ContainerFolded(object sender, NodeEventArgs e)
{
ContainerNode cont = e.Node as ContainerNode;
if (cont != null)
{
cont.Resize(cont.UnfoldedSize.Width, cont.Bounds.Height);
}
}
Then, after the first fold/unfold, the attached ShapeNode is moved outside the ContainerNode's boundaries (to the right). What's more, the container is not resized to its original size. If I move the containerNode, the ShapeNode is moved to where it belongs (but the containerNode is still with a bad size).
To test this, I added a button to the Entities sample project. The action related to this button does:
private void button2_Click(object sender, EventArgs e)
{
ContainerNode cont = this.diagram.Factory.CreateContainerNode(10, 10, 100, 50, true);
RectangleF nodeBounds = cont.Bounds;
Image image = images.Images[4];
float x = nodeBounds.Right - image.Width;
float y = nodeBounds.Bottom - image.Height;
AttachToNode attType = AttachToNode.BottomRight;
ShapeNode btn = this.diagram.Factory.CreateShapeNode(x, y, image.Width, image.Height);
btn.Transparent = true;
btn.Image = image;
btn.ImageAlign = ImageAlign.Center;
btn.AttachTo(cont, attType);
btn.Locked = true;
btn.Obstacle = false;
btn.Constraints.KeepInsideParent = true;
if (cont.SubordinateGroup != null)
{
cont.SubordinateGroup.AutoDeleteItems = true;
cont.SubordinateGroup.FollowMasterContainment = true;
cont.SubordinateGroup.FollowMasterRotation = true;
}
}
After that, you just have to create a comment, fold/unfold it and that's it (you don't have to put anything in it).
Do you know what causes this?
Thanks,
Marie