wSplit.cs
using System; using System.Windows.Forms; using System.Drawing; public class WSplit : WCtrl { class SplitPanel { Panel[] panel = new Panel[2]; public Panel this[int i] { get{ if( 0 <= i && i <= 1 ) return panel[i]; else return null; } set{ if( 0 <= i && i <= 1 ) panel[i] = value; } } } SplitPanel panel; SplitContainer split; public WSplit(bool vert) { ctrl = split = new SplitContainer(); anchorAll(); dockFill(); if( vert ) { split.Orientation = Orientation.Vertical; } else { split.Orientation = Orientation.Horizontal; } split.SplitterDistance = (int)(split.ClientSize.Width * 0.8); panel = new SplitPanel(); panel[0] = split.Panel1; panel[1] = split.Panel2; //split.AutoScaleMode = AutoScaleMode.None; //split.Size = new Size(100,200); //split.SplitterWidth = 6; //split.Location = new Point(0, 0); //split.FixedPanel = FixedPanel.Panel1; //split.Panel1MinSize = 100; //split.Panel1Collapsed = false; //split.Panel2MinSize = 100; //split.Panel1Collapsed = false; //split.Show(); } public WSplit() : this(true) {} public void Add(int i, Control ctrl) { panel[i].Controls.Add(ctrl); } public void FixWidth(int i) { split.FixedPanel = i == 0 ? FixedPanel.Panel1 : FixedPanel.Panel2; } public void SetBackColor(int i, Color color) { panel[i].BackColor = color; //Color.Green, Color.Yellow } public void SetForeColor(int i, Color color) { panel[i].ForeColor = color; } public void Hide(int i) { if( i == 0 ) split.Panel1Collapsed = true; else split.Panel2Collapsed = true; } public void Show(int i) { if( i == 0 ) split.Panel1Collapsed = false; else split.Panel2Collapsed = false; } }
댓글 없음:
댓글 쓰기