Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Layout Overlap (Read 1149 times)
Devon
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Apr 13th, 2011
Layout Overlap
Apr 13th, 2011 at 5:40pm
Print Post  
I start out placing a bunch of shapes on the diagram and having them arranged using layeredlayout. Later in the program place new shapes on the diagram and I want to arrange them on the grid and not change the position of the shapes already their.

If I use a any of the layouts and have it only arrange the new shapes, they will over lap with the previously placed shapes. If I set all the previous shapes' Ignorelayout property to true I get the same results.

Is there anyway I can add new shapes to the diagram and arrange them keeping the position of existing shapes with no overlapping of the shapes?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Layout Overlap
Reply #1 - Apr 13th, 2011 at 6:15pm
Print Post  
With force-directed layout classes you could set their LayoutArea property to be the part of the diagram to the right of the already arranged items.

The other classes do not provide such property, but you could temporarily change diagram.Bounds so that it starts from the right of the arranged items, and restore its original value after calling Arrange:
Code
Select All
RectangleF GetBounds(DiagramItemCollection items)
{
	if (items.Count == 0)
		return RectangleF.Empty;

	RectangleF union = items[0].GetBounds();
	foreach (DiagramItem item in items)
		union = RectangleF.Union(union, item.GetBounds());
	return union;
}

RectangleF b = diagram.Bounds;
RectangleF r = GetBounds(arrangedItems);
diagram.Bounds = RectangleF.FromLTRB(r.Right,b.Top,r.Right+1000, b.Bottom);
layout.Arrange(newItems);
diagram.Bounds = b;
 

  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint