public FormTab() { TabControl tc = new TabControl { Dock = DockStyle.Fill }; TabPage page = new TabPage(); var tlp1 = new TableLayoutPanel(); tlp1.Dock = DockStyle.Top; tlp1.AutoSize = true; tlp1.BackColor = Color.Bisque; var tlp2 = new TableLayoutPanel(); tlp2.Dock = DockStyle.Bottom; tlp2.AutoSize = true; tlp2.BackColor = Color.DarkSeaGreen; VFLP p = new VFLP(); p.SuspendLayout(); p.Controls.Add(tlp2); p.Controls.Add(tlp1); page.Controls.Add(p); //page.Controls.Add(tlp2); //page.Controls.Add(tlp1); for (var i = 0; i < 10; i++) { tlp1.Controls.Add(new TextBox() { Text = string.Format("page1. {0}", i) }); tlp2.Controls.Add(new TextBox() { Text = string.Format("page2. {0}", i) }); } this.DoubleClick += delegate { Size s = page.GetPreferredSize(Size.Empty); int bp = 1; }; tc.TabPages.Add(page); page.AutoScroll = true; Controls.Add(tc); p.ResumeLayout(true); }
public static GroupBox CreateGBox(String title, params Control[] arr) { GB gb = new GB { Text = title, AutoSize = true, AutoSizeMode = AutoSizeMode.GrowAndShrink, Font = new Font("Arial", 11, FontStyle.Bold) }; VFLP p = new VFLP(); gb.Controls.Add(p); for (int i = 0; i < arr.Length; i += 2) { var c = CreateHPanel(arr[i], arr[i + 1]); p.Controls.Add(c); } return(gb); }