private void AddToLeft(IBTabControl tc2) { if (P1 == null) { P1 = new IBPanel(); P1.Children.Add(tc2); P1.TC = tc2; } else { P1.RemoveFromParent(); } if (P2 == null) { P2 = new IBPanel(); P2.Children.Add(TC); P2.TC = TC; } else { P2.RemoveFromParent(); } ColumnDefinition newColumn1 = new ColumnDefinition() { Width = new GridLength(200, GridUnitType.Pixel), MinWidth = 50.0 }; ColumnDefinition newColumn2 = new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star), MinWidth = 50.0 }; ColumnDefinitions.Add(newColumn1); ColumnDefinitions.Add(newColumn2); P1.CurrentPos = Position.left; P1.SetColumnRow(); PS.Height = double.NaN; PS.Margin = new Thickness(-3, 0, 0, 0); PS.VerticalAlignment = VerticalAlignment.Stretch; PS.HorizontalAlignment = HorizontalAlignment.Left; PS.SetValue(ColumnProperty, 1); P2.CurrentPos = Position.right; P2.SetColumnRow(); Children.Add(P1); Children.Add(PS); Children.Add(P2); }
/// <summary> /// 全てのIBPanelを調べてレイアウトの不整合を修正します /// </summary> public static void ResetLayout() { foreach (IBPanel p in AllIBPanelList) { IBPanel p1 = null, p2 = null; foreach (object o in p.Children) { if (p1 == null) { p1 = o as IBPanel; } else if (p2 == null) { p2 = o as IBPanel; } } if (p1 != null && p2 != null) { switch (p1.CurrentPos) { case Position.left: p2.CurrentPos = Position.right; break; case Position.right: p2.CurrentPos = Position.left; break; case Position.top: p2.CurrentPos = Position.bottom; break; case Position.bottom: p2.CurrentPos = Position.top; break; default: break; } p1.SetColumnRow(); p2.SetColumnRow(); if (p.TC != null) { p.TC.EndDrag(); } if (p1.TC != null) { p1.TC.EndDrag(); } if (p2.TC != null) { p2.TC.EndDrag(); } if (p.P1 == null) { p.P1 = p1; } if (p.P2 == null) { p.P2 = p2; } } } }