public Layout.SpNode GetNode() { var node = new Layout.SpNode(); if (scPanel.Panel1Collapsed == false) { node.Left = lPanel.GetLayout(); } if (scPanel.Panel2Collapsed == false) { node.Right = rPanel.GetLayout(); } node.Orientation = scPanel.Orientation == Orientation.Horizontal ? 1 : 2; node.SplitDist = scPanel.SplitterDistance / (decimal)(scPanel.Orientation == Orientation.Horizontal ? scPanel.Height : scPanel.Width); return(node); }
public void SetNode(Layout.SpNode node) { if (node == null) { return; } SetDirection(node.Orientation == 1 ? Orientation.Horizontal : Orientation.Vertical, (int)(node.SplitDist * (node.Orientation == 1 ? scPanel.Height : scPanel.Width))); if (node.Left != null) { lPanel.SetLayout(node.Left); scPanel.Panel1Collapsed = false; } if (node.Right != null) { rPanel.SetLayout(node.Right); scPanel.Panel2Collapsed = false; } }