Hello Stoyan,
Ok, so first Ill show you a bit of code to put you in context.
In my containers I overide the draw & GetBounds Fuctions.
Here is my container's GetBounds Function
public override RectangleF GetBounds()
{
RectangleF bounds = new RectangleF(
base.GetBounds().X,
base.GetBounds().Y,
Folded ? _foldedWidth : base.GetBounds().Width,
Folded ? _foldedHeight : base.GetBounds().Height);
return bounds;
}
I move the nodes in an undo operation. Which means the nodes are still in the container when I move them but removed right after.
I use the move function :
node.Move(location.X, location.Y);
I tried the setBounds(location, false, true) functions but it didn't changed anything, and the move function fix another bug I have.
So when I place just 1 node into my container and undo the operation, the node is moved back to where it was and the container does not move which is exactly what I want.
But if I put 2 nodes in the container at the same time (as a Selection), when I undo, 2 move operations are called, one on each node, at this step, the container is moved which is strange...
I put a print for the container bounds into my Container.GetBounds overriden fuction and I wrapped the move operation of the node with other print.
Here are the results
*Initial container bounds (the 2 nodes are in the container)*
Container Bounds : X=359,4416 Y=78,63958 W=61,88333 H=58,44166
*Move back first node*
---- Move node to X=421,2499 Y=184,9916
Initial node bounds X=369,4416 Y=95,63958
Final node bounds X=421,2499 Y=184,9916
*Move back second node*
---- Move node to X=470,4625 Y=162,9354
Initial node bounds X=386,325 Y=102,0812
Final node bounds X=470,4625 Y=162,9354
*2 calls to container.GetBounds(), first is correct, second is not, who changed it ?*
Container Bounds : X=359,4416 Y=78,63958 W=61,88333 H=58,44166
Container Bounds : X=460,4625 Y=145,9354 W=50 H=52
I hope it is clear enough,
thanks again for the help.
Amaury