protected override void CreateChildControls() { Controls.Clear(); ResizablePanel first = GetFirstPanel(); Controls.Add(first); Controls.Add(GetDivider()); Controls.Add(GetSecondPanel(first)); base.CreateChildControls(); }
private ResizablePanel GetFirstPanel() { ResizablePanel first; if (FirstPanelContainer == null) { _FirstPanelContainer = new ResizablePanel(); if (!(_FirstPanel == null)) { _FirstPanel.InstantiateIn(_FirstPanelContainer); } } first = FirstPanelContainer; first.ID = "first"; first.ApplyStyle(FirstPanelStyle); switch (Orientation) { case Orientation.Horizontal: first.Style["float"] = "left"; if (SplitterPosition.IsEmpty) { first.Width = new Unit(RealWidth.Value / 2, RealWidth.Type); } else { first.Width = SplitterPosition; } first.Height = Unit.Parse("100%"); break; case Orientation.Vertical: if (SplitterPosition.IsEmpty) { first.Height = new Unit(RealHeight.Value / 2, RealHeight.Type); } else { first.Height = SplitterPosition; } first.Width = Unit.Parse("100%"); break; } if (this.DesignMode) { /* * first.Style("border") = "solid 1px red" */ } return(first); }
private ResizablePanel GetSecondPanel(ResizablePanel firstPanel) { ResizablePanel second; if (SecondPanelContainer == null) { _SecondPanelContainer = new ResizablePanel(); if (!(_SecondPanel == null)) { _SecondPanel.InstantiateIn(_SecondPanelContainer); } } second = SecondPanelContainer; second.ID = "second"; second.ApplyStyle(SecondPanelStyle); switch (Orientation) { case Orientation.Horizontal: second.Style["float"] = "left"; if (second.Width.IsEmpty) { second.Width = new Unit(firstPanel.Width.Value - 7, firstPanel.Width.Type); } second.Height = Unit.Parse("100%"); break; case Orientation.Vertical: if (second.Height.IsEmpty) { second.Height = new Unit(firstPanel.Height.Value - 7, firstPanel.Height.Type); } second.Width = Unit.Parse("100%"); break; } return(second); }