protected void UpdateSurroundings(IPanelGroupElement left, IPanelGroupElement top, IPanelGroupElement right, IPanelGroupElement bottom) { surroundings[(int)Direction.Left] = left; surroundings[(int)Direction.Top] = top; surroundings[(int)Direction.Right] = right; surroundings[(int)Direction.Bottom] = bottom; bool horizontal = IsInSameDirection(Direction.Right); for (int i = 0; i < elements.Count; i++) { if (horizontal) { left = i > 0 ? elements[i - 1] : surroundings[(int)Direction.Left]; right = i < elements.Count - 1 ? elements[i + 1] : surroundings[(int)Direction.Right]; } else { bottom = i > 0 ? elements[i - 1] : surroundings[(int)Direction.Bottom]; top = i < elements.Count - 1 ? elements[i + 1] : surroundings[(int)Direction.Top]; } PanelGroup subGroup = elements[i] as PanelGroup; if (subGroup != null) { subGroup.UpdateSurroundings(left, top, right, bottom); } else { ((Panel)elements[i]).Internal.UpdateSurroundings(left, top, right, bottom); } } }
public void UpdateSurroundings(IPanelGroupElement left, IPanelGroupElement top, IPanelGroupElement right, IPanelGroupElement bottom) { group.UpdateSurroundings(left, top, right, bottom); }